"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OrgLimitAggregateModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class OrgLimitAggregateModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('OrgLimitAggregate', 'orgLimitAggregates', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgLimitAggregateFilter', 'OrgLimitAggregateOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitAggregate',
            fieldName: 'orgLimitAggregates',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('OrgLimitAggregate', 'orgLimitAggregates', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'OrgLimitAggregateFilter', 'OrgLimitAggregateOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitAggregate',
            fieldName: 'orgLimitAggregate',
            document,
            variables,
            transform: (data) => ({
                orgLimitAggregate: data.orgLimitAggregates?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('OrgLimitAggregate', 'orgLimitAggregates', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgLimitAggregateFilter', 'OrgLimitAggregateOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitAggregate',
            fieldName: 'orgLimitAggregate',
            document,
            variables,
            transform: (data) => ({
                orgLimitAggregate: data.orgLimitAggregates?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('OrgLimitAggregate', 'createOrgLimitAggregate', 'orgLimitAggregate', args.select, args.data, 'CreateOrgLimitAggregateInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitAggregate',
            fieldName: 'createOrgLimitAggregate',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('OrgLimitAggregate', 'updateOrgLimitAggregate', 'orgLimitAggregate', args.select, args.where.id, args.data, 'UpdateOrgLimitAggregateInput', 'id', 'orgLimitAggregatePatch', input_types_1.connectionFieldsMap, undefined);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitAggregate',
            fieldName: 'updateOrgLimitAggregate',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('OrgLimitAggregate', 'deleteOrgLimitAggregate', 'orgLimitAggregate', {
            id: args.where.id,
        }, 'DeleteOrgLimitAggregateInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitAggregate',
            fieldName: 'deleteOrgLimitAggregate',
            document,
            variables,
        });
    }
}
exports.OrgLimitAggregateModel = OrgLimitAggregateModel;
