import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class AppLimitModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('AppLimit', 'appLimits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'AppLimitFilter', 'AppLimitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLimit',
            fieldName: 'appLimits',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('AppLimit', 'appLimits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'AppLimitFilter', 'AppLimitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLimit',
            fieldName: 'appLimit',
            document,
            variables,
            transform: (data) => ({
                appLimit: data.appLimits?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('AppLimit', 'appLimits', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'AppLimitFilter', 'AppLimitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLimit',
            fieldName: 'appLimit',
            document,
            variables,
            transform: (data) => ({
                appLimit: data.appLimits?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('AppLimit', 'createAppLimit', 'appLimit', args.select, args.data, 'CreateAppLimitInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLimit',
            fieldName: 'createAppLimit',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('AppLimit', 'updateAppLimit', 'appLimit', args.select, args.where.id, args.data, 'UpdateAppLimitInput', 'id', 'appLimitPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLimit',
            fieldName: 'updateAppLimit',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('AppLimit', 'deleteAppLimit', 'appLimit', {
            id: args.where.id,
        }, 'DeleteAppLimitInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLimit',
            fieldName: 'deleteAppLimit',
            document,
            variables,
        });
    }
}
