"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApiSettingModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class ApiSettingModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('ApiSetting', 'apiSettings', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'ApiSettingFilter', 'ApiSettingOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ApiSetting',
            fieldName: 'apiSettings',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('ApiSetting', 'apiSettings', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'ApiSettingFilter', 'ApiSettingOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ApiSetting',
            fieldName: 'apiSetting',
            document,
            variables,
            transform: (data) => ({
                apiSetting: data.apiSettings?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('ApiSetting', 'apiSettings', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'ApiSettingFilter', 'ApiSettingOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ApiSetting',
            fieldName: 'apiSetting',
            document,
            variables,
            transform: (data) => ({
                apiSetting: data.apiSettings?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('ApiSetting', 'createApiSetting', 'apiSetting', args.select, args.data, 'CreateApiSettingInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ApiSetting',
            fieldName: 'createApiSetting',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('ApiSetting', 'updateApiSetting', 'apiSetting', args.select, args.where.id, args.data, 'UpdateApiSettingInput', 'id', 'apiSettingPatch', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ApiSetting',
            fieldName: 'updateApiSetting',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('ApiSetting', 'deleteApiSetting', 'apiSetting', {
            id: args.where.id,
        }, 'DeleteApiSettingInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ApiSetting',
            fieldName: 'deleteApiSetting',
            document,
            variables,
        });
    }
}
exports.ApiSettingModel = ApiSettingModel;
