"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DbPresetModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class DbPresetModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('DbPreset', 'dbPresets', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'DbPresetFilter', 'DbPresetOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DbPreset',
            fieldName: 'dbPresets',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('DbPreset', 'dbPresets', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'DbPresetFilter', 'DbPresetOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DbPreset',
            fieldName: 'dbPreset',
            document,
            variables,
            transform: (data) => ({
                dbPreset: data.dbPresets?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('DbPreset', 'dbPresets', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'DbPresetFilter', 'DbPresetOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DbPreset',
            fieldName: 'dbPreset',
            document,
            variables,
            transform: (data) => ({
                dbPreset: data.dbPresets?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('DbPreset', 'createDbPreset', 'dbPreset', args.select, args.data, 'CreateDbPresetInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DbPreset',
            fieldName: 'createDbPreset',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('DbPreset', 'updateDbPreset', 'dbPreset', args.select, args.where.id, args.data, 'UpdateDbPresetInput', 'id', 'dbPresetPatch', input_types_1.connectionFieldsMap, undefined);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DbPreset',
            fieldName: 'updateDbPreset',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('DbPreset', 'deleteDbPreset', 'dbPreset', {
            id: args.where.id,
        }, 'DeleteDbPresetInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DbPreset',
            fieldName: 'deleteDbPreset',
            document,
            variables,
        });
    }
}
exports.DbPresetModel = DbPresetModel;
