import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildFindOneDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class FunctionGraphObjectModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('FunctionGraphObject', 'functionGraphObjects', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'FunctionGraphObjectFilter', 'FunctionGraphObjectOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphObject',
            fieldName: 'functionGraphObjects',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('FunctionGraphObject', 'functionGraphObjects', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FunctionGraphObjectFilter', 'FunctionGraphObjectOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphObject',
            fieldName: 'functionGraphObject',
            document,
            variables,
            transform: (data) => ({
                functionGraphObject: data.functionGraphObjects?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindOneDocument('FunctionGraphObject', 'getNodeAtPath', args.id, args.select, 'id', 'UUID!', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FunctionGraphObject',
            fieldName: 'functionGraphObject',
            document,
            variables,
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('FunctionGraphObject', 'createFunctionGraphObject', 'functionGraphObject', args.select, args.data, 'CreateFunctionGraphObjectInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphObject',
            fieldName: 'createFunctionGraphObject',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('FunctionGraphObject', 'updateFunctionGraphObject', 'functionGraphObject', args.select, args.where.id, args.data, 'UpdateFunctionGraphObjectInput', 'id', 'functionGraphObjectPatch', connectionFieldsMap, {
            databaseId: args.where.databaseId,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphObject',
            fieldName: 'updateFunctionGraphObject',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('FunctionGraphObject', 'deleteFunctionGraphObject', 'functionGraphObject', {
            id: args.where.id,
            databaseId: args.where.databaseId,
        }, 'DeleteFunctionGraphObjectInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FunctionGraphObject',
            fieldName: 'deleteFunctionGraphObject',
            document,
            variables,
        });
    }
}
