import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class RateLimitMetersModuleModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('RateLimitMetersModule', 'rateLimitMetersModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'RateLimitMetersModuleFilter', 'RateLimitMetersModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'RateLimitMetersModule',
            fieldName: 'rateLimitMetersModules',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('RateLimitMetersModule', 'rateLimitMetersModules', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'RateLimitMetersModuleFilter', 'RateLimitMetersModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'RateLimitMetersModule',
            fieldName: 'rateLimitMetersModule',
            document,
            variables,
            transform: (data) => ({
                rateLimitMetersModule: data.rateLimitMetersModules?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('RateLimitMetersModule', 'rateLimitMetersModules', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'RateLimitMetersModuleFilter', 'RateLimitMetersModuleOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'RateLimitMetersModule',
            fieldName: 'rateLimitMetersModule',
            document,
            variables,
            transform: (data) => ({
                rateLimitMetersModule: data.rateLimitMetersModules?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('RateLimitMetersModule', 'createRateLimitMetersModule', 'rateLimitMetersModule', args.select, args.data, 'CreateRateLimitMetersModuleInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'RateLimitMetersModule',
            fieldName: 'createRateLimitMetersModule',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('RateLimitMetersModule', 'updateRateLimitMetersModule', 'rateLimitMetersModule', args.select, args.where.id, args.data, 'UpdateRateLimitMetersModuleInput', 'id', 'rateLimitMetersModulePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'RateLimitMetersModule',
            fieldName: 'updateRateLimitMetersModule',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('RateLimitMetersModule', 'deleteRateLimitMetersModule', 'rateLimitMetersModule', {
            id: args.where.id,
        }, 'DeleteRateLimitMetersModuleInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'RateLimitMetersModule',
            fieldName: 'deleteRateLimitMetersModule',
            document,
            variables,
        });
    }
}
