import { TicketApprovalStatus } from './Approval'; import { TicketTaskStatus } from './Task'; import { ITicketAuditedEntity, TicketPropertyValue, TicketStage } from "./Common"; import type { TicketMessageActorType } from "./Conversation"; export interface ITicketStatus extends ITicketAuditedEntity { name: string; description?: string; color?: string; icon?: string; stage: TicketStage; order: number; isInitial: boolean; isFinal: boolean; enabled: boolean; version: number; } export interface ITicketStatusCreateDTO extends Omit { } export interface ITicketStatusUpdateDTO extends Partial> { id: string; expectedVersion: number; } export declare enum TicketConditionOperator { EQUALS = "EQUALS", NOT_EQUALS = "NOT_EQUALS", EXISTS = "EXISTS", NOT_EXISTS = "NOT_EXISTS", GREATER_THAN = "GREATER_THAN", GREATER_THAN_OR_EQUAL = "GREATER_THAN_OR_EQUAL", LESS_THAN = "LESS_THAN", LESS_THAN_OR_EQUAL = "LESS_THAN_OR_EQUAL", CONTAINS = "CONTAINS", NOT_CONTAINS = "NOT_CONTAINS", IN = "IN", NOT_IN = "NOT_IN" } export declare enum TicketTransitionConditionType { FIELD = "FIELD", ACTIVITY_OCCURRED = "ACTIVITY_OCCURRED", FORM_SUBMITTED = "FORM_SUBMITTED", APPROVAL_COMPLETED = "APPROVAL_COMPLETED", TASK_COMPLETED = "TASK_COMPLETED", ALL_REQUIRED_TASKS_COMPLETED = "ALL_REQUIRED_TASKS_COMPLETED", CHECKLIST_COMPLETED = "CHECKLIST_COMPLETED" } export interface ITicketTransitionCondition { id: string; type: TicketTransitionConditionType; operator: TicketConditionOperator; fieldNameKey?: string; activityType?: string; formId?: string; approvalProcessDefinitionId?: string; approvalStatus?: TicketApprovalStatus; taskId?: string; taskDefinitionId?: string; requiredTaskStatus?: TicketTaskStatus; checklistItemId?: string; expectedValue?: TicketPropertyValue; } export interface ICreateTicketTransitionConditionDTO extends Omit { } export interface IUpdateTicketTransitionConditionDTO extends Partial> { id: string; } export interface ITicketTransition extends ITicketAuditedEntity { name?: string; fromStatusId: string; toStatusId: string; enabled: boolean; version: number; allowedRoleIds?: string[]; conditions: ITicketTransitionCondition[]; } export interface ICreateTicketTransitionDTO extends Omit { conditions: ICreateTicketTransitionConditionDTO[]; } export interface IUpdateTicketTransitionDTO extends Partial> { id: string; expectedVersion: number; } export declare enum TicketActivityType { CREATED = "CREATED", UPDATED = "UPDATED", STATUS_CHANGED = "STATUS_CHANGED", ASSIGNMENT_CHANGED = "ASSIGNMENT_CHANGED", COMMENTED = "COMMENTED", ATTACHMENT_ADDED = "ATTACHMENT_ADDED", ATTACHMENT_DELETED = "ATTACHMENT_DELETED", FORM_SUBMITTED = "FORM_SUBMITTED", APPROVAL_COMPLETED = "APPROVAL_COMPLETED", TASK_COMPLETED = "TASK_COMPLETED", ALL_REQUIRED_TASKS_COMPLETED = "ALL_REQUIRED_TASKS_COMPLETED", CHECKLIST_COMPLETED = "CHECKLIST_COMPLETED", TICKET_EVENT = "TICKET_EVENT" } export interface ITicketFieldChange { fieldNameKey: string; previousValue?: TicketPropertyValue; newValue?: TicketPropertyValue; } /** * Actor identity is split in two columns and exactly one of them is populated: * * | actorType | Identity field | Notes | * |-------------------------|---------------------|----------------------------------------| * | AGENT | actorId (uuid) | an internal user | * | CONTACT | actorExternalId | a Mongo ObjectId | * | EXTERNAL_COLLABORATOR | actorExternalId | not produced yet | * | BOT | actorExternalId | not produced yet | * | SYSTEM | neither | schedulers, migrations, processor jobs | * * Both identity fields are absent for SYSTEM. Rows written before `actorType` * existed have none, and must be read as AGENT when `actorId` is present and as * SYSTEM when it is not. */ export interface ITicketActivity { id: string; spaceId: string; ticketId: string; type: TicketActivityType; ticketEventType?: string; actorId?: string; actorType?: TicketMessageActorType; actorExternalId?: string; occurredAt: Date; comment?: string; attachmentIds?: string[]; changes?: ITicketFieldChange[]; metadata?: { [key: string]: TicketPropertyValue; }; } export interface ITicketFormRequirement { id: string; formId: string; formVersion?: number; requiredOnCreate?: boolean; requiredForStatusIds?: string[]; } export interface ITicketFormSubmissionReference { formId: string; submissionId: string; formVersion?: number; submittedAt: Date; submittedBy: string; } /** Body of GET /approval-definitions/{id}/usages. */ export interface IApprovalDefinitionUsages { categories: { id: string; name: string; }[]; /** * `transitions` and `macros` ARE resolvable: an APPROVAL_COMPLETED transition * condition stores the approvalProcessDefinitionId it gates on, and a * START_APPROVAL macro action stores its definitionId. * * `workflows` stays unsupported because a "workflow" is the status+transition * graph, not a stored entity that references a definition on its own — the * relationship materializes as the transitions above. `automations` stays * unsupported because no automation entity references an approval definition * in this schema. */ workflows: { supported: false; }; transitions: { id: string; name: string; }[]; automations: { supported: false; }; macros: { id: string; name: string; }[]; }