import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class FunctionGraphModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('FunctionGraph', 'functionGraphs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'FunctionGraphFilter', 'FunctionGraphOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraph',
            fieldName: 'functionGraphs',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('FunctionGraph', 'functionGraphs', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionGraphFilter', 'FunctionGraphOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraph',
            fieldName: 'functionGraph',
            document,
            variables,
            transform: (data) => ({
                functionGraph: data.functionGraphs?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('FunctionGraph', 'functionGraphs', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FunctionGraphFilter', 'FunctionGraphOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraph',
            fieldName: 'functionGraph',
            document,
            variables,
            transform: (data) => ({
                functionGraph: data.functionGraphs?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('FunctionGraph', 'createFunctionGraph', 'functionGraph', args.select, args.data, 'CreateFunctionGraphInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraph',
            fieldName: 'createFunctionGraph',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('FunctionGraph', 'updateFunctionGraph', 'functionGraph', args.select, args.where.id, args.data, 'UpdateFunctionGraphInput', 'id', 'functionGraphPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraph',
            fieldName: 'updateFunctionGraph',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('FunctionGraph', 'deleteFunctionGraph', 'functionGraph', {
            id: args.where.id,
        }, 'DeleteFunctionGraphInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraph',
            fieldName: 'deleteFunctionGraph',
            document,
            variables,
        });
    }
}
