import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class CryptoAddressesModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('CryptoAddressesModule', 'cryptoAddressesModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'CryptoAddressesModuleFilter', 'CryptoAddressesModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'CryptoAddressesModule',
            fieldName: 'cryptoAddressesModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('CryptoAddressesModule', 'cryptoAddressesModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'CryptoAddressesModuleFilter', 'CryptoAddressesModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'CryptoAddressesModule',
            fieldName: 'cryptoAddressesModule',
            document,
            variables,
            transform: (data) => ({
                cryptoAddressesModule: data.cryptoAddressesModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('CryptoAddressesModule', 'cryptoAddressesModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'CryptoAddressesModuleFilter', 'CryptoAddressesModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'CryptoAddressesModule',
            fieldName: 'cryptoAddressesModule',
            document,
            variables,
            transform: (data) => ({
                cryptoAddressesModule: data.cryptoAddressesModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('CryptoAddressesModule', 'createCryptoAddressesModule', 'cryptoAddressesModule', args.select, args.data, 'CreateCryptoAddressesModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'CryptoAddressesModule',
            fieldName: 'createCryptoAddressesModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('CryptoAddressesModule', 'updateCryptoAddressesModule', 'cryptoAddressesModule', args.select, args.where.id, args.data, 'UpdateCryptoAddressesModuleInput', 'id', 'cryptoAddressesModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'CryptoAddressesModule',
            fieldName: 'updateCryptoAddressesModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('CryptoAddressesModule', 'deleteCryptoAddressesModule', 'cryptoAddressesModule', {
            id: args.where.id,
        }, 'DeleteCryptoAddressesModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'CryptoAddressesModule',
            fieldName: 'deleteCryptoAddressesModule',
            document,
            variables,
        });
    }
}
