"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FunctionModuleModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class FunctionModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('FunctionModule', 'functionModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'FunctionModuleFilter', 'FunctionModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionModule',
            fieldName: 'functionModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('FunctionModule', 'functionModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionModuleFilter', 'FunctionModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionModule',
            fieldName: 'functionModule',
            document,
            variables,
            transform: (data) => ({
                functionModule: data.functionModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('FunctionModule', 'functionModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FunctionModuleFilter', 'FunctionModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionModule',
            fieldName: 'functionModule',
            document,
            variables,
            transform: (data) => ({
                functionModule: data.functionModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('FunctionModule', 'createFunctionModule', 'functionModule', args.select, args.data, 'CreateFunctionModuleInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionModule',
            fieldName: 'createFunctionModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('FunctionModule', 'updateFunctionModule', 'functionModule', args.select, args.where.id, args.data, 'UpdateFunctionModuleInput', 'id', 'functionModulePatch', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionModule',
            fieldName: 'updateFunctionModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('FunctionModule', 'deleteFunctionModule', 'functionModule', {
            id: args.where.id,
        }, 'DeleteFunctionModuleInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionModule',
            fieldName: 'deleteFunctionModule',
            document,
            variables,
        });
    }
}
exports.FunctionModuleModel = FunctionModuleModel;
