"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppLimitCreditModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class AppLimitCreditModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('AppLimitCredit', 'appLimitCredits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'AppLimitCreditFilter', 'AppLimitCreditOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLimitCredit',
            fieldName: 'appLimitCredits',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('AppLimitCredit', 'appLimitCredits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'AppLimitCreditFilter', 'AppLimitCreditOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLimitCredit',
            fieldName: 'appLimitCredit',
            document,
            variables,
            transform: (data) => ({
                appLimitCredit: data.appLimitCredits?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('AppLimitCredit', 'appLimitCredits', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'AppLimitCreditFilter', 'AppLimitCreditOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLimitCredit',
            fieldName: 'appLimitCredit',
            document,
            variables,
            transform: (data) => ({
                appLimitCredit: data.appLimitCredits?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('AppLimitCredit', 'createAppLimitCredit', 'appLimitCredit', args.select, args.data, 'CreateAppLimitCreditInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLimitCredit',
            fieldName: 'createAppLimitCredit',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('AppLimitCredit', 'updateAppLimitCredit', 'appLimitCredit', args.select, args.where.id, args.data, 'UpdateAppLimitCreditInput', 'id', 'appLimitCreditPatch', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLimitCredit',
            fieldName: 'updateAppLimitCredit',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('AppLimitCredit', 'deleteAppLimitCredit', 'appLimitCredit', {
            id: args.where.id,
        }, 'DeleteAppLimitCreditInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLimitCredit',
            fieldName: 'deleteAppLimitCredit',
            document,
            variables,
        });
    }
}
exports.AppLimitCreditModel = AppLimitCreditModel;
