import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class OrgLimitModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('OrgLimit', 'orgLimits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgLimitFilter', 'OrgLimitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimit',
            fieldName: 'orgLimits',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('OrgLimit', 'orgLimits', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'OrgLimitFilter', 'OrgLimitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimit',
            fieldName: 'orgLimit',
            document,
            variables,
            transform: (data) => ({
                orgLimit: data.orgLimits?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('OrgLimit', 'orgLimits', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgLimitFilter', 'OrgLimitOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimit',
            fieldName: 'orgLimit',
            document,
            variables,
            transform: (data) => ({
                orgLimit: data.orgLimits?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('OrgLimit', 'createOrgLimit', 'orgLimit', args.select, args.data, 'CreateOrgLimitInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimit',
            fieldName: 'createOrgLimit',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('OrgLimit', 'updateOrgLimit', 'orgLimit', args.select, args.where.id, args.data, 'UpdateOrgLimitInput', 'id', 'orgLimitPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimit',
            fieldName: 'updateOrgLimit',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('OrgLimit', 'deleteOrgLimit', 'orgLimit', {
            id: args.where.id,
        }, 'DeleteOrgLimitInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimit',
            fieldName: 'deleteOrgLimit',
            document,
            variables,
        });
    }
}
