import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class OrgLimitCapsDefaultModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('OrgLimitCapsDefault', 'orgLimitCapsDefaults', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgLimitCapsDefaultFilter', 'OrgLimitCapsDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitCapsDefault',
            fieldName: 'orgLimitCapsDefaults',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('OrgLimitCapsDefault', 'orgLimitCapsDefaults', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'OrgLimitCapsDefaultFilter', 'OrgLimitCapsDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitCapsDefault',
            fieldName: 'orgLimitCapsDefault',
            document,
            variables,
            transform: (data) => ({
                orgLimitCapsDefault: data.orgLimitCapsDefaults?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('OrgLimitCapsDefault', 'orgLimitCapsDefaults', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgLimitCapsDefaultFilter', 'OrgLimitCapsDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgLimitCapsDefault',
            fieldName: 'orgLimitCapsDefault',
            document,
            variables,
            transform: (data) => ({
                orgLimitCapsDefault: data.orgLimitCapsDefaults?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('OrgLimitCapsDefault', 'createOrgLimitCapsDefault', 'orgLimitCapsDefault', args.select, args.data, 'CreateOrgLimitCapsDefaultInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitCapsDefault',
            fieldName: 'createOrgLimitCapsDefault',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('OrgLimitCapsDefault', 'updateOrgLimitCapsDefault', 'orgLimitCapsDefault', args.select, args.where.id, args.data, 'UpdateOrgLimitCapsDefaultInput', 'id', 'orgLimitCapsDefaultPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitCapsDefault',
            fieldName: 'updateOrgLimitCapsDefault',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('OrgLimitCapsDefault', 'deleteOrgLimitCapsDefault', 'orgLimitCapsDefault', {
            id: args.where.id,
        }, 'DeleteOrgLimitCapsDefaultInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgLimitCapsDefault',
            fieldName: 'deleteOrgLimitCapsDefault',
            document,
            variables,
        });
    }
}
