import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class RateLimitsModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('RateLimitsModule', 'rateLimitsModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'RateLimitsModuleFilter', 'RateLimitsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'RateLimitsModule',
            fieldName: 'rateLimitsModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('RateLimitsModule', 'rateLimitsModules', args.select, {
            where: args?.where,
        }, 'RateLimitsModuleFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'RateLimitsModule',
            fieldName: 'rateLimitsModules',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('RateLimitsModule', 'rateLimitsModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'RateLimitsModuleFilter', 'RateLimitsModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'RateLimitsModule',
            fieldName: 'rateLimitsModule',
            document,
            variables,
            transform: (data) => ({
                rateLimitsModule: data.rateLimitsModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('RateLimitsModule', 'createRateLimitsModule', 'rateLimitsModule', args.select, args.data, 'CreateRateLimitsModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'RateLimitsModule',
            fieldName: 'createRateLimitsModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('RateLimitsModule', 'updateRateLimitsModule', 'rateLimitsModule', args.select, args.where.id, args.data, 'UpdateRateLimitsModuleInput', 'id', 'rateLimitsModulePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'RateLimitsModule',
            fieldName: 'updateRateLimitsModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('RateLimitsModule', 'deleteRateLimitsModule', 'rateLimitsModule', {
            id: args.where.id,
        }, 'DeleteRateLimitsModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'RateLimitsModule',
            fieldName: 'deleteRateLimitsModule',
            document,
            variables,
        });
    }
}
