"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FunctionInvocationModuleModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class FunctionInvocationModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('FunctionInvocationModule', 'functionInvocationModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'FunctionInvocationModuleFilter', 'FunctionInvocationModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionInvocationModule',
            fieldName: 'functionInvocationModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('FunctionInvocationModule', 'functionInvocationModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionInvocationModuleFilter', 'FunctionInvocationModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionInvocationModule',
            fieldName: 'functionInvocationModule',
            document,
            variables,
            transform: (data) => ({
                functionInvocationModule: data.functionInvocationModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('FunctionInvocationModule', 'functionInvocationModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FunctionInvocationModuleFilter', 'FunctionInvocationModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionInvocationModule',
            fieldName: 'functionInvocationModule',
            document,
            variables,
            transform: (data) => ({
                functionInvocationModule: data.functionInvocationModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('FunctionInvocationModule', 'createFunctionInvocationModule', 'functionInvocationModule', args.select, args.data, 'CreateFunctionInvocationModuleInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionInvocationModule',
            fieldName: 'createFunctionInvocationModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('FunctionInvocationModule', 'updateFunctionInvocationModule', 'functionInvocationModule', args.select, args.where.id, args.data, 'UpdateFunctionInvocationModuleInput', 'id', 'functionInvocationModulePatch', input_types_1.connectionFieldsMap, undefined);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionInvocationModule',
            fieldName: 'updateFunctionInvocationModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('FunctionInvocationModule', 'deleteFunctionInvocationModule', 'functionInvocationModule', {
            id: args.where.id,
        }, 'DeleteFunctionInvocationModuleInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionInvocationModule',
            fieldName: 'deleteFunctionInvocationModule',
            document,
            variables,
        });
    }
}
exports.FunctionInvocationModuleModel = FunctionInvocationModuleModel;
