import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class OrgLimitAggregateModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('OrgLimitAggregate', 'orgLimitAggregates', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgLimitAggregateFilter', 'OrgLimitAggregateOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitAggregate',
            fieldName: 'orgLimitAggregates',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('OrgLimitAggregate', 'orgLimitAggregates', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'OrgLimitAggregateFilter', 'OrgLimitAggregateOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitAggregate',
            fieldName: 'orgLimitAggregate',
            document,
            variables,
            transform: (data) => ({
                orgLimitAggregate: data.orgLimitAggregates?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('OrgLimitAggregate', 'orgLimitAggregates', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgLimitAggregateFilter', 'OrgLimitAggregateOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitAggregate',
            fieldName: 'orgLimitAggregate',
            document,
            variables,
            transform: (data) => ({
                orgLimitAggregate: data.orgLimitAggregates?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('OrgLimitAggregate', 'createOrgLimitAggregate', 'orgLimitAggregate', args.select, args.data, 'CreateOrgLimitAggregateInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitAggregate',
            fieldName: 'createOrgLimitAggregate',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('OrgLimitAggregate', 'updateOrgLimitAggregate', 'orgLimitAggregate', args.select, args.where.id, args.data, 'UpdateOrgLimitAggregateInput', 'id', 'orgLimitAggregatePatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitAggregate',
            fieldName: 'updateOrgLimitAggregate',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('OrgLimitAggregate', 'deleteOrgLimitAggregate', 'orgLimitAggregate', {
            id: args.where.id,
        }, 'DeleteOrgLimitAggregateInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitAggregate',
            fieldName: 'deleteOrgLimitAggregate',
            document,
            variables,
        });
    }
}
