import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class BillingProviderModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('BillingProviderModule', 'billingProviderModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'BillingProviderModuleFilter', 'BillingProviderModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'BillingProviderModule',
            fieldName: 'billingProviderModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('BillingProviderModule', 'billingProviderModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'BillingProviderModuleFilter', 'BillingProviderModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'BillingProviderModule',
            fieldName: 'billingProviderModule',
            document,
            variables,
            transform: (data) => ({
                billingProviderModule: data.billingProviderModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('BillingProviderModule', 'billingProviderModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'BillingProviderModuleFilter', 'BillingProviderModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'BillingProviderModule',
            fieldName: 'billingProviderModule',
            document,
            variables,
            transform: (data) => ({
                billingProviderModule: data.billingProviderModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('BillingProviderModule', 'createBillingProviderModule', 'billingProviderModule', args.select, args.data, 'CreateBillingProviderModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'BillingProviderModule',
            fieldName: 'createBillingProviderModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('BillingProviderModule', 'updateBillingProviderModule', 'billingProviderModule', args.select, args.where.id, args.data, 'UpdateBillingProviderModuleInput', 'id', 'billingProviderModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'BillingProviderModule',
            fieldName: 'updateBillingProviderModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('BillingProviderModule', 'deleteBillingProviderModule', 'billingProviderModule', {
            id: args.where.id,
        }, 'DeleteBillingProviderModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'BillingProviderModule',
            fieldName: 'deleteBillingProviderModule',
            document,
            variables,
        });
    }
}
