"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class ObjectModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('Object', 'objects', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'ObjectFilter', 'ObjectOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'Object',
            fieldName: 'objects',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('Object', 'objects', args.select, {
            where: args?.where,
        }, 'ObjectFilter', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'Object',
            fieldName: 'objects',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindOneDocument)('Object', 'getNodeAtPath', args.id, args.select, 'id', 'UUID!', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'Object',
            fieldName: 'getNodeAtPath',
            document,
            variables,
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('Object', 'createObject', 'object', args.select, args.data, 'CreateObjectInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'Object',
            fieldName: 'createObject',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('Object', 'updateObject', 'object', args.select, args.where.id, args.data, 'UpdateObjectInput', 'id', 'objectPatch', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'Object',
            fieldName: 'updateObject',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('Object', 'deleteObject', 'object', {
            id: args.where.id,
        }, 'DeleteObjectInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'Object',
            fieldName: 'deleteObject',
            document,
            variables,
        });
    }
}
exports.ObjectModel = ObjectModel;
