import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class BillingModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('BillingModule', 'billingModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'BillingModuleFilter', 'BillingModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'BillingModule',
            fieldName: 'billingModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('BillingModule', 'billingModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'BillingModuleFilter', 'BillingModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'BillingModule',
            fieldName: 'billingModule',
            document,
            variables,
            transform: (data) => ({
                billingModule: data.billingModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('BillingModule', 'billingModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'BillingModuleFilter', 'BillingModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'BillingModule',
            fieldName: 'billingModule',
            document,
            variables,
            transform: (data) => ({
                billingModule: data.billingModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('BillingModule', 'createBillingModule', 'billingModule', args.select, args.data, 'CreateBillingModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'BillingModule',
            fieldName: 'createBillingModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('BillingModule', 'updateBillingModule', 'billingModule', args.select, args.where.id, args.data, 'UpdateBillingModuleInput', 'id', 'billingModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'BillingModule',
            fieldName: 'updateBillingModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('BillingModule', 'deleteBillingModule', 'billingModule', {
            id: args.where.id,
        }, 'DeleteBillingModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'BillingModule',
            fieldName: 'deleteBillingModule',
            document,
            variables,
        });
    }
}
