import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class AppLimitDefaultModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('AppLimitDefault', 'appLimitDefaults', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'AppLimitDefaultFilter', 'AppLimitDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLimitDefault',
            fieldName: 'appLimitDefaults',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('AppLimitDefault', 'appLimitDefaults', args.select, {
            where: args?.where,
        }, 'AppLimitDefaultFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLimitDefault',
            fieldName: 'appLimitDefaults',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('AppLimitDefault', 'appLimitDefaults', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'AppLimitDefaultFilter', 'AppLimitDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AppLimitDefault',
            fieldName: 'appLimitDefault',
            document,
            variables,
            transform: (data) => ({
                appLimitDefault: data.appLimitDefaults?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('AppLimitDefault', 'createAppLimitDefault', 'appLimitDefault', args.select, args.data, 'CreateAppLimitDefaultInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLimitDefault',
            fieldName: 'createAppLimitDefault',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('AppLimitDefault', 'updateAppLimitDefault', 'appLimitDefault', args.select, args.where.id, args.data, 'UpdateAppLimitDefaultInput', 'id', 'appLimitDefaultPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLimitDefault',
            fieldName: 'updateAppLimitDefault',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('AppLimitDefault', 'deleteAppLimitDefault', 'appLimitDefault', {
            id: args.where.id,
        }, 'DeleteAppLimitDefaultInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AppLimitDefault',
            fieldName: 'deleteAppLimitDefault',
            document,
            variables,
        });
    }
}
