import { ITicketAuditedEntity, TicketPriority, TicketPropertyValue } from "./Common"; import { TicketConditionOperator } from "./Workflow"; export declare enum SlaTimeMode { CALENDAR = "CALENDAR", BUSINESS_HOURS = "BUSINESS_HOURS" } export declare enum SlaMetricType { FIRST_RESPONSE = "FIRST_RESPONSE", NEXT_RESPONSE = "NEXT_RESPONSE", RESOLUTION = "RESOLUTION", ASSIGNMENT = "ASSIGNMENT", ACCEPTANCE = "ACCEPTANCE", PERIODIC_UPDATE = "PERIODIC_UPDATE", STATUS_TIME = "STATUS_TIME", CUSTOM = "CUSTOM" } export declare enum SlaStatus { PENDING = "PENDING", MET = "MET", BREACHED = "BREACHED", PAUSED = "PAUSED", NOT_APPLICABLE = "NOT_APPLICABLE" } export declare enum ServiceCommitmentType { SLA = "SLA", OLA = "OLA", UC = "UC" } export declare enum SlaPolicyChangeBehavior { KEEP_ORIGINAL = "KEEP_ORIGINAL", RECALCULATE_FROM_ORIGINAL_START = "RECALCULATE_FROM_ORIGINAL_START", RESTART_FROM_CHANGE = "RESTART_FROM_CHANGE" } export declare enum SlaCycleStartBehavior { ONCE = "ONCE", EACH_MATCHING_EVENT = "EACH_MATCHING_EVENT", ON_REOPEN = "ON_REOPEN" } export declare enum SlaEventType { TICKET_CREATED = "TICKET_CREATED", STATUS_ENTERED = "STATUS_ENTERED", STATUS_EXITED = "STATUS_EXITED", ASSIGNED = "ASSIGNED", ASSIGNMENT_ACCEPTED = "ASSIGNMENT_ACCEPTED", PUBLIC_MESSAGE_RECEIVED = "PUBLIC_MESSAGE_RECEIVED", PUBLIC_AGENT_RESPONSE_SENT = "PUBLIC_AGENT_RESPONSE_SENT", RESOLVED = "RESOLVED", REOPENED = "REOPENED", CUSTOM = "CUSTOM" } export declare enum WeekDay { MONDAY = "MONDAY", TUESDAY = "TUESDAY", WEDNESDAY = "WEDNESDAY", THURSDAY = "THURSDAY", FRIDAY = "FRIDAY", SATURDAY = "SATURDAY", SUNDAY = "SUNDAY" } export interface IBusinessTimeRange { start: string; end: string; } export interface IBusinessDaySchedule { day: WeekDay; enabled: boolean; ranges: IBusinessTimeRange[]; } export interface IBusinessCalendarException { date: Date; name?: string; working: boolean; ranges?: IBusinessTimeRange[]; } export interface IBusinessCalendar extends ITicketAuditedEntity { name: string; timeZone: string; schedule: IBusinessDaySchedule[]; exceptions: IBusinessCalendarException[]; enabled: boolean; } export interface ISlaEventMatcher { eventType: SlaEventType; statusId?: string; customEventType?: string; conditions?: ISlaPolicyCondition[]; } export interface ISlaMetricDefinition extends ITicketAuditedEntity { code: string; name: string; description?: string; type: SlaMetricType; statusId?: string; customEventType?: string; startEvent: ISlaEventMatcher; completionEvent: ISlaEventMatcher; cycleStartBehavior: SlaCycleStartBehavior; enabled: boolean; } export interface ISlaWarningThreshold { id: string; percentage?: number; remainingMinutes?: number; escalationPolicyId?: string; notificationTemplateId?: string; } export interface ISlaTarget { id?: string; /** New policies should use metricDefinitionId; metric is retained for compatibility. */ metricDefinitionId?: string; metric?: SlaMetricType; durationMinutes: number; mode: SlaTimeMode; businessCalendarId?: string; warningThresholds?: ISlaWarningThreshold[]; pauseConditions?: ISlaConditionGroup; resetBehavior?: SlaPolicyChangeBehavior; } export interface ISlaPolicyCondition { fieldNameKey: string; operator: TicketConditionOperator; expectedValue?: TicketPropertyValue; } export declare enum SlaConditionGroupOperator { AND = "AND", OR = "OR" } export interface ISlaConditionGroup { operator: SlaConditionGroupOperator; conditions?: ISlaPolicyCondition[]; groups?: ISlaConditionGroup[]; } export interface IServiceCommitment { id: string; type: ServiceCommitmentType; name: string; customerOrganizationId?: string; responsibleGroupId?: string; providerId?: string; targets: ISlaTarget[]; } export interface ITicketSlaPolicy extends ITicketAuditedEntity { name: string; description?: string; enabled: boolean; order: number; version?: number; priority?: TicketPriority; categoryIds?: string[]; conditions?: ISlaPolicyCondition[]; conditionGroup?: ISlaConditionGroup; /** Retained for simple and legacy policies. */ targets: ISlaTarget[]; commitments?: IServiceCommitment[]; pausableStatusIds?: string[]; policyChangeBehavior?: SlaPolicyChangeBehavior; reopenBehavior?: SlaPolicyChangeBehavior; } export interface ISlaPausePeriod { startedAt: Date; endedAt?: Date; reason?: string; startedByEventId?: string; endedByEventId?: string; } export interface ISlaTargetSnapshot { metricDefinitionId?: string; metricType: SlaMetricType; durationMinutes: number; mode: SlaTimeMode; businessCalendarId?: string; warningThresholds?: ISlaWarningThreshold[]; } export interface ISlaMetricCycle { id: string; metricDefinitionId?: string; sequence: number; status: SlaStatus; startedAt: Date; dueAt?: Date; nextWarningAt?: Date; completedAt?: Date; breachedAt?: Date; elapsedMinutes: number; pausedMinutes: number; pausePeriods: ISlaPausePeriod[]; targetSnapshot: ISlaTargetSnapshot; startedByEventId?: string; completedByEventId?: string; } export interface ISlaMetricState { /** metric is retained for consumers of the original contract. */ metric: SlaMetricType; metricDefinitionId?: string; status: SlaStatus; activeCycleId?: string; current?: ISlaMetricCycle; cycles?: ISlaMetricCycle[]; totalBreaches?: number; startedAt?: Date; dueAt?: Date; completedAt?: Date; breachedAt?: Date; elapsedMinutes: number; pausedMinutes: number; pausePeriods?: ISlaPausePeriod[]; } export interface IServiceCommitmentState { commitmentId: string; type: ServiceCommitmentType; policyId: string; policyVersion: number; metrics: ISlaMetricState[]; hasActiveBreach: boolean; nextDeadlineAt?: Date; nextWarningAt?: Date; } export interface ITicketSlaState { policyId: string; policyVersion?: number; metrics: ISlaMetricState[]; commitments?: IServiceCommitmentState[]; nextDeadlineAt?: Date; nextWarningAt?: Date; hasActiveBreach: boolean; /** @deprecated Read the FIRST_RESPONSE entry from metrics. */ firstResponse?: ISlaMetricState; /** @deprecated Read the RESOLUTION entry from metrics. */ resolution?: ISlaMetricState; } export interface ISlaEvaluationEvent { eventId: string; spaceId: string; ticketId: string; type: SlaEventType; occurredAt: Date; statusId?: string; customEventType?: string; actorId?: string; metadata?: { [key: string]: TicketPropertyValue; }; } export interface ISlaWarningEvent { id: string; spaceId: string; ticketId: string; metricCycleId: string; thresholdId: string; occurredAt: Date; escalationPolicyId?: string; notificationTemplateId?: string; }