import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class CryptoAddressModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('CryptoAddress', 'cryptoAddresses', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'CryptoAddressFilter', 'CryptoAddressOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'CryptoAddress',
            fieldName: 'cryptoAddresses',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('CryptoAddress', 'cryptoAddresses', args.select, {
            where: args?.where,
        }, 'CryptoAddressFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'CryptoAddress',
            fieldName: 'cryptoAddresses',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('CryptoAddress', 'cryptoAddresses', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'CryptoAddressFilter', 'CryptoAddressOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'CryptoAddress',
            fieldName: 'cryptoAddress',
            document,
            variables,
            transform: (data) => ({
                cryptoAddress: data.cryptoAddresses?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('CryptoAddress', 'createCryptoAddress', 'cryptoAddress', args.select, args.data, 'CreateCryptoAddressInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'CryptoAddress',
            fieldName: 'createCryptoAddress',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('CryptoAddress', 'updateCryptoAddress', 'cryptoAddress', args.select, args.where.id, args.data, 'UpdateCryptoAddressInput', 'id', 'cryptoAddressPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'CryptoAddress',
            fieldName: 'updateCryptoAddress',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('CryptoAddress', 'deleteCryptoAddress', 'cryptoAddress', {
            id: args.where.id,
        }, 'DeleteCryptoAddressInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'CryptoAddress',
            fieldName: 'deleteCryptoAddress',
            document,
            variables,
        });
    }
}
