import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class AgentModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('AgentModule', 'agentModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'AgentModuleFilter', 'AgentModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AgentModule',
            fieldName: 'agentModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('AgentModule', 'agentModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'AgentModuleFilter', 'AgentModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AgentModule',
            fieldName: 'agentModule',
            document,
            variables,
            transform: (data) => ({
                agentModule: data.agentModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('AgentModule', 'agentModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'AgentModuleFilter', 'AgentModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AgentModule',
            fieldName: 'agentModule',
            document,
            variables,
            transform: (data) => ({
                agentModule: data.agentModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('AgentModule', 'createAgentModule', 'agentModule', args.select, args.data, 'CreateAgentModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AgentModule',
            fieldName: 'createAgentModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('AgentModule', 'updateAgentModule', 'agentModule', args.select, args.where.id, args.data, 'UpdateAgentModuleInput', 'id', 'agentModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AgentModule',
            fieldName: 'updateAgentModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('AgentModule', 'deleteAgentModule', 'agentModule', {
            id: args.where.id,
        }, 'DeleteAgentModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AgentModule',
            fieldName: 'deleteAgentModule',
            document,
            variables,
        });
    }
}
