"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OrgLimitEventModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class OrgLimitEventModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('OrgLimitEvent', 'orgLimitEvents', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgLimitEventFilter', 'OrgLimitEventOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitEvent',
            fieldName: 'orgLimitEvents',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('OrgLimitEvent', 'orgLimitEvents', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'OrgLimitEventFilter', 'OrgLimitEventOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitEvent',
            fieldName: 'orgLimitEvent',
            document,
            variables,
            transform: (data) => ({
                orgLimitEvent: data.orgLimitEvents?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('OrgLimitEvent', 'orgLimitEvents', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgLimitEventFilter', 'OrgLimitEventOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitEvent',
            fieldName: 'orgLimitEvent',
            document,
            variables,
            transform: (data) => ({
                orgLimitEvent: data.orgLimitEvents?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('OrgLimitEvent', 'createOrgLimitEvent', 'orgLimitEvent', args.select, args.data, 'CreateOrgLimitEventInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitEvent',
            fieldName: 'createOrgLimitEvent',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('OrgLimitEvent', 'updateOrgLimitEvent', 'orgLimitEvent', args.select, args.where.id, args.data, 'UpdateOrgLimitEventInput', 'id', 'orgLimitEventPatch', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitEvent',
            fieldName: 'updateOrgLimitEvent',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('OrgLimitEvent', 'deleteOrgLimitEvent', 'orgLimitEvent', {
            id: args.where.id,
        }, 'DeleteOrgLimitEventInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitEvent',
            fieldName: 'deleteOrgLimitEvent',
            document,
            variables,
        });
    }
}
exports.OrgLimitEventModel = OrgLimitEventModel;
