"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AgentPersonaModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class AgentPersonaModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.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', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AgentPersona',
            fieldName: 'agentPersonas',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('AgentPersona', 'agentPersonas', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'AgentPersonaFilter', 'AgentPersonaOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.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 } = (0, query_builder_1.buildFindManyDocument)('AgentPersona', 'agentPersonas', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'AgentPersonaFilter', 'AgentPersonaOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.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 } = (0, query_builder_1.buildCreateDocument)('AgentPersona', 'createAgentPersona', 'agentPersona', args.select, args.data, 'CreateAgentPersonaInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AgentPersona',
            fieldName: 'createAgentPersona',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('AgentPersona', 'updateAgentPersona', 'agentPersona', args.select, args.where.id, args.data, 'UpdateAgentPersonaInput', 'id', 'agentPersonaPatch', input_types_1.connectionFieldsMap, undefined);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AgentPersona',
            fieldName: 'updateAgentPersona',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('AgentPersona', 'deleteAgentPersona', 'agentPersona', {
            id: args.where.id,
        }, 'DeleteAgentPersonaInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AgentPersona',
            fieldName: 'deleteAgentPersona',
            document,
            variables,
        });
    }
}
exports.AgentPersonaModel = AgentPersonaModel;
