import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class OrgLimitDefaultModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('OrgLimitDefault', 'orgLimitDefaults', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgLimitDefaultFilter', 'OrgLimitDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitDefault',
            fieldName: 'orgLimitDefaults',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('OrgLimitDefault', 'orgLimitDefaults', args.select, {
            where: args?.where,
        }, 'OrgLimitDefaultFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitDefault',
            fieldName: 'orgLimitDefaults',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('OrgLimitDefault', 'orgLimitDefaults', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgLimitDefaultFilter', 'OrgLimitDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitDefault',
            fieldName: 'orgLimitDefault',
            document,
            variables,
            transform: (data) => ({
                orgLimitDefault: data.orgLimitDefaults?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('OrgLimitDefault', 'createOrgLimitDefault', 'orgLimitDefault', args.select, args.data, 'CreateOrgLimitDefaultInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitDefault',
            fieldName: 'createOrgLimitDefault',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('OrgLimitDefault', 'updateOrgLimitDefault', 'orgLimitDefault', args.select, args.where.id, args.data, 'UpdateOrgLimitDefaultInput', 'id', 'orgLimitDefaultPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitDefault',
            fieldName: 'updateOrgLimitDefault',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('OrgLimitDefault', 'deleteOrgLimitDefault', 'orgLimitDefault', {
            id: args.where.id,
        }, 'DeleteOrgLimitDefaultInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitDefault',
            fieldName: 'deleteOrgLimitDefault',
            document,
            variables,
        });
    }
}
