import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class LimitsModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('LimitsModule', 'limitsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'LimitsModuleFilter', 'LimitsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'LimitsModule',
            fieldName: 'limitsModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('LimitsModule', 'limitsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'LimitsModuleFilter', 'LimitsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'LimitsModule',
            fieldName: 'limitsModule',
            document,
            variables,
            transform: (data) => ({
                limitsModule: data.limitsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('LimitsModule', 'limitsModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'LimitsModuleFilter', 'LimitsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'LimitsModule',
            fieldName: 'limitsModule',
            document,
            variables,
            transform: (data) => ({
                limitsModule: data.limitsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('LimitsModule', 'createLimitsModule', 'limitsModule', args.select, args.data, 'CreateLimitsModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'LimitsModule',
            fieldName: 'createLimitsModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('LimitsModule', 'updateLimitsModule', 'limitsModule', args.select, args.where.id, args.data, 'UpdateLimitsModuleInput', 'id', 'limitsModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'LimitsModule',
            fieldName: 'updateLimitsModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('LimitsModule', 'deleteLimitsModule', 'limitsModule', {
            id: args.where.id,
        }, 'DeleteLimitsModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'LimitsModule',
            fieldName: 'deleteLimitsModule',
            document,
            variables,
        });
    }
}
