import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class AgentPersonaModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('AgentPersona', 'agentPersonas', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'AgentPersonaFilter', 'AgentPersonaOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AgentPersona',
            fieldName: 'agentPersonas',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('AgentPersona', 'agentPersonas', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'AgentPersonaFilter', 'AgentPersonaOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AgentPersona',
            fieldName: 'agentPersona',
            document,
            variables,
            transform: (data) => ({
                agentPersona: data.agentPersonas?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('AgentPersona', 'agentPersonas', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'AgentPersonaFilter', 'AgentPersonaOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AgentPersona',
            fieldName: 'agentPersona',
            document,
            variables,
            transform: (data) => ({
                agentPersona: data.agentPersonas?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('AgentPersona', 'createAgentPersona', 'agentPersona', args.select, args.data, 'CreateAgentPersonaInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AgentPersona',
            fieldName: 'createAgentPersona',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('AgentPersona', 'updateAgentPersona', 'agentPersona', args.select, args.where.id, args.data, 'UpdateAgentPersonaInput', 'id', 'agentPersonaPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AgentPersona',
            fieldName: 'updateAgentPersona',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('AgentPersona', 'deleteAgentPersona', 'agentPersona', {
            id: args.where.id,
        }, 'DeleteAgentPersonaInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AgentPersona',
            fieldName: 'deleteAgentPersona',
            document,
            variables,
        });
    }
}
