"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MerkleStoreModuleModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class MerkleStoreModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('MerkleStoreModule', 'merkleStoreModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'MerkleStoreModuleFilter', 'MerkleStoreModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'MerkleStoreModule',
            fieldName: 'merkleStoreModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('MerkleStoreModule', 'merkleStoreModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'MerkleStoreModuleFilter', 'MerkleStoreModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'MerkleStoreModule',
            fieldName: 'merkleStoreModule',
            document,
            variables,
            transform: (data) => ({
                merkleStoreModule: data.merkleStoreModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('MerkleStoreModule', 'merkleStoreModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'MerkleStoreModuleFilter', 'MerkleStoreModuleOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'MerkleStoreModule',
            fieldName: 'merkleStoreModule',
            document,
            variables,
            transform: (data) => ({
                merkleStoreModule: data.merkleStoreModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('MerkleStoreModule', 'createMerkleStoreModule', 'merkleStoreModule', args.select, args.data, 'CreateMerkleStoreModuleInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'MerkleStoreModule',
            fieldName: 'createMerkleStoreModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('MerkleStoreModule', 'updateMerkleStoreModule', 'merkleStoreModule', args.select, args.where.id, args.data, 'UpdateMerkleStoreModuleInput', 'id', 'merkleStoreModulePatch', input_types_1.connectionFieldsMap, undefined);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'MerkleStoreModule',
            fieldName: 'updateMerkleStoreModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('MerkleStoreModule', 'deleteMerkleStoreModule', 'merkleStoreModule', {
            id: args.where.id,
        }, 'DeleteMerkleStoreModuleInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'MerkleStoreModule',
            fieldName: 'deleteMerkleStoreModule',
            document,
            variables,
        });
    }
}
exports.MerkleStoreModuleModel = MerkleStoreModuleModel;
