import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class MerkleStoreModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = 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', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'MerkleStoreModule',
            fieldName: 'merkleStoreModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('MerkleStoreModule', 'merkleStoreModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'MerkleStoreModuleFilter', 'MerkleStoreModuleOrderBy', connectionFieldsMap);
        return new 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 } = buildFindManyDocument('MerkleStoreModule', 'merkleStoreModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'MerkleStoreModuleFilter', 'MerkleStoreModuleOrderBy', connectionFieldsMap);
        return new 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 } = buildCreateDocument('MerkleStoreModule', 'createMerkleStoreModule', 'merkleStoreModule', args.select, args.data, 'CreateMerkleStoreModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'MerkleStoreModule',
            fieldName: 'createMerkleStoreModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('MerkleStoreModule', 'updateMerkleStoreModule', 'merkleStoreModule', args.select, args.where.id, args.data, 'UpdateMerkleStoreModuleInput', 'id', 'merkleStoreModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'MerkleStoreModule',
            fieldName: 'updateMerkleStoreModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('MerkleStoreModule', 'deleteMerkleStoreModule', 'merkleStoreModule', {
            id: args.where.id,
        }, 'DeleteMerkleStoreModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'MerkleStoreModule',
            fieldName: 'deleteMerkleStoreModule',
            document,
            variables,
        });
    }
}
