import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class FunctionGraphExecutionOutputModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('FunctionGraphExecutionOutput', 'functionGraphExecutionOutputs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'FunctionGraphExecutionOutputFilter', 'FunctionGraphExecutionOutputOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphExecutionOutput',
            fieldName: 'functionGraphExecutionOutputs',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('FunctionGraphExecutionOutput', 'functionGraphExecutionOutputs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionGraphExecutionOutputFilter', 'FunctionGraphExecutionOutputOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphExecutionOutput',
            fieldName: 'functionGraphExecutionOutput',
            document,
            variables,
            transform: (data) => ({
                functionGraphExecutionOutput: data.functionGraphExecutionOutputs?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('FunctionGraphExecutionOutput', 'functionGraphExecutionOutputs', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FunctionGraphExecutionOutputFilter', 'FunctionGraphExecutionOutputOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphExecutionOutput',
            fieldName: 'functionGraphExecutionOutput',
            document,
            variables,
            transform: (data) => ({
                functionGraphExecutionOutput: data.functionGraphExecutionOutputs?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('FunctionGraphExecutionOutput', 'createFunctionGraphExecutionOutput', 'functionGraphExecutionOutput', args.select, args.data, 'CreateFunctionGraphExecutionOutputInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphExecutionOutput',
            fieldName: 'createFunctionGraphExecutionOutput',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('FunctionGraphExecutionOutput', 'updateFunctionGraphExecutionOutput', 'functionGraphExecutionOutput', args.select, args.where.id, args.data, 'UpdateFunctionGraphExecutionOutputInput', 'id', 'functionGraphExecutionOutputPatch', connectionFieldsMap, {
            createdAt: args.where.createdAt,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphExecutionOutput',
            fieldName: 'updateFunctionGraphExecutionOutput',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('FunctionGraphExecutionOutput', 'deleteFunctionGraphExecutionOutput', 'functionGraphExecutionOutput', {
            id: args.where.id,
            createdAt: args.where.createdAt,
        }, 'DeleteFunctionGraphExecutionOutputInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphExecutionOutput',
            fieldName: 'deleteFunctionGraphExecutionOutput',
            document,
            variables,
        });
    }
}
