import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class FunctionGraphExecutionModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('FunctionGraphExecution', 'functionGraphExecutions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'FunctionGraphExecutionFilter', 'FunctionGraphExecutionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphExecution',
            fieldName: 'functionGraphExecutions',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('FunctionGraphExecution', 'functionGraphExecutions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionGraphExecutionFilter', 'FunctionGraphExecutionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphExecution',
            fieldName: 'functionGraphExecution',
            document,
            variables,
            transform: (data) => ({
                functionGraphExecution: data.functionGraphExecutions?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('FunctionGraphExecution', 'functionGraphExecutions', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FunctionGraphExecutionFilter', 'FunctionGraphExecutionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphExecution',
            fieldName: 'functionGraphExecution',
            document,
            variables,
            transform: (data) => ({
                functionGraphExecution: data.functionGraphExecutions?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('FunctionGraphExecution', 'createFunctionGraphExecution', 'functionGraphExecution', args.select, args.data, 'CreateFunctionGraphExecutionInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphExecution',
            fieldName: 'createFunctionGraphExecution',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('FunctionGraphExecution', 'updateFunctionGraphExecution', 'functionGraphExecution', args.select, args.where.id, args.data, 'UpdateFunctionGraphExecutionInput', 'id', 'functionGraphExecutionPatch', connectionFieldsMap, {
            startedAt: args.where.startedAt,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphExecution',
            fieldName: 'updateFunctionGraphExecution',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('FunctionGraphExecution', 'deleteFunctionGraphExecution', 'functionGraphExecution', {
            id: args.where.id,
            startedAt: args.where.startedAt,
        }, 'DeleteFunctionGraphExecutionInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphExecution',
            fieldName: 'deleteFunctionGraphExecution',
            document,
            variables,
        });
    }
}
