import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class FunctionApiBindingModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('FunctionApiBinding', 'functionApiBindings', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'FunctionApiBindingFilter', 'FunctionApiBindingOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionApiBinding',
            fieldName: 'functionApiBindings',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('FunctionApiBinding', 'functionApiBindings', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionApiBindingFilter', 'FunctionApiBindingOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionApiBinding',
            fieldName: 'functionApiBinding',
            document,
            variables,
            transform: (data) => ({
                functionApiBinding: data.functionApiBindings?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('FunctionApiBinding', 'functionApiBindings', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FunctionApiBindingFilter', 'FunctionApiBindingOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionApiBinding',
            fieldName: 'functionApiBinding',
            document,
            variables,
            transform: (data) => ({
                functionApiBinding: data.functionApiBindings?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('FunctionApiBinding', 'createFunctionApiBinding', 'functionApiBinding', args.select, args.data, 'CreateFunctionApiBindingInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionApiBinding',
            fieldName: 'createFunctionApiBinding',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('FunctionApiBinding', 'updateFunctionApiBinding', 'functionApiBinding', args.select, args.where.id, args.data, 'UpdateFunctionApiBindingInput', 'id', 'functionApiBindingPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionApiBinding',
            fieldName: 'updateFunctionApiBinding',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('FunctionApiBinding', 'deleteFunctionApiBinding', 'functionApiBinding', {
            id: args.where.id,
        }, 'DeleteFunctionApiBindingInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionApiBinding',
            fieldName: 'deleteFunctionApiBinding',
            document,
            variables,
        });
    }
}
