import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class FunctionInvocationModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = 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', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionInvocationModule',
            fieldName: 'functionInvocationModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('FunctionInvocationModule', 'functionInvocationModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionInvocationModuleFilter', 'FunctionInvocationModuleOrderBy', connectionFieldsMap);
        return new 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 } = buildFindManyDocument('FunctionInvocationModule', 'functionInvocationModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FunctionInvocationModuleFilter', 'FunctionInvocationModuleOrderBy', connectionFieldsMap);
        return new 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 } = buildCreateDocument('FunctionInvocationModule', 'createFunctionInvocationModule', 'functionInvocationModule', args.select, args.data, 'CreateFunctionInvocationModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionInvocationModule',
            fieldName: 'createFunctionInvocationModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('FunctionInvocationModule', 'updateFunctionInvocationModule', 'functionInvocationModule', args.select, args.where.id, args.data, 'UpdateFunctionInvocationModuleInput', 'id', 'functionInvocationModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionInvocationModule',
            fieldName: 'updateFunctionInvocationModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('FunctionInvocationModule', 'deleteFunctionInvocationModule', 'functionInvocationModule', {
            id: args.where.id,
        }, 'DeleteFunctionInvocationModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionInvocationModule',
            fieldName: 'deleteFunctionInvocationModule',
            document,
            variables,
        });
    }
}
