"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OrgLimitCreditModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class OrgLimitCreditModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('OrgLimitCredit', 'orgLimitCredits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgLimitCreditFilter', 'OrgLimitCreditOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitCredit',
            fieldName: 'orgLimitCredits',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('OrgLimitCredit', 'orgLimitCredits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'OrgLimitCreditFilter', 'OrgLimitCreditOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitCredit',
            fieldName: 'orgLimitCredit',
            document,
            variables,
            transform: (data) => ({
                orgLimitCredit: data.orgLimitCredits?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('OrgLimitCredit', 'orgLimitCredits', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgLimitCreditFilter', 'OrgLimitCreditOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitCredit',
            fieldName: 'orgLimitCredit',
            document,
            variables,
            transform: (data) => ({
                orgLimitCredit: data.orgLimitCredits?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('OrgLimitCredit', 'createOrgLimitCredit', 'orgLimitCredit', args.select, args.data, 'CreateOrgLimitCreditInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitCredit',
            fieldName: 'createOrgLimitCredit',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('OrgLimitCredit', 'updateOrgLimitCredit', 'orgLimitCredit', args.select, args.where.id, args.data, 'UpdateOrgLimitCreditInput', 'id', 'orgLimitCreditPatch', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitCredit',
            fieldName: 'updateOrgLimitCredit',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('OrgLimitCredit', 'deleteOrgLimitCredit', 'orgLimitCredit', {
            id: args.where.id,
        }, 'DeleteOrgLimitCreditInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitCredit',
            fieldName: 'deleteOrgLimitCredit',
            document,
            variables,
        });
    }
}
exports.OrgLimitCreditModel = OrgLimitCreditModel;
