import { ITicketCursorResponse } from "./Api"; import { ITicketAuditedEntity, TicketPropertyValue } from "./Common"; import { TicketFieldType } from "./Fields"; import { TicketConditionOperator } from "./Workflow"; export declare enum TicketSecurityResourceType { TICKET = "TICKET", CATEGORY = "CATEGORY", VIEW = "VIEW", FIELD = "FIELD", COMMENT = "COMMENT", ATTACHMENT = "ATTACHMENT", REPORT = "REPORT", EXPORT = "EXPORT", CONFIGURATION = "CONFIGURATION" } export declare enum TicketSecurityOperation { CREATE = "CREATE", READ = "READ", UPDATE = "UPDATE", DELETE = "DELETE", ASSIGN = "ASSIGN", TRANSITION = "TRANSITION", COMMENT_PUBLIC = "COMMENT_PUBLIC", COMMENT_INTERNAL = "COMMENT_INTERNAL", VIEW_INTERNAL_COMMENTS = "VIEW_INTERNAL_COMMENTS", VIEW_PII = "VIEW_PII", REDACT = "REDACT", EXPORT = "EXPORT", MANAGE = "MANAGE", IMPERSONATE = "IMPERSONATE" } export declare enum TicketPolicyEffect { ALLOW = "ALLOW", DENY = "DENY" } export declare enum TicketPolicyConditionGroupOperator { AND = "AND", OR = "OR" } export declare enum TicketSensitivityLevel { PUBLIC = "PUBLIC", INTERNAL = "INTERNAL", CONFIDENTIAL = "CONFIDENTIAL", RESTRICTED = "RESTRICTED" } export declare enum TicketDataClassification { PUBLIC = "PUBLIC", INTERNAL = "INTERNAL", CONFIDENTIAL = "CONFIDENTIAL", PII = "PII", SENSITIVE_PII = "SENSITIVE_PII", FINANCIAL = "FINANCIAL", HEALTH = "HEALTH", LEGAL = "LEGAL" } export declare enum TicketMaskingStrategy { NONE = "NONE", FULL = "FULL", PARTIAL = "PARTIAL", HASH = "HASH", TOKENIZE = "TOKENIZE" } export declare enum TicketRedactionStatus { REQUESTED = "REQUESTED", PROCESSING = "PROCESSING", COMPLETED = "COMPLETED", REJECTED = "REJECTED", FAILED = "FAILED" } export declare enum TicketRetentionAction { ARCHIVE = "ARCHIVE", ANONYMIZE = "ANONYMIZE", DELETE = "DELETE", REVIEW = "REVIEW" } export declare enum TicketLegalHoldStatus { ACTIVE = "ACTIVE", RELEASED = "RELEASED" } export declare enum TicketAccessAuditAction { READ = "READ", SEARCH = "SEARCH", DOWNLOAD_ATTACHMENT = "DOWNLOAD_ATTACHMENT", EXPORT = "EXPORT", VIEW_PII = "VIEW_PII", REDACT = "REDACT", IMPERSONATE = "IMPERSONATE", DELEGATED_ACCESS = "DELEGATED_ACCESS", MANAGE = "MANAGE" } export declare enum TicketDelegatedAccessStatus { PENDING = "PENDING", ACTIVE = "ACTIVE", REVOKED = "REVOKED", EXPIRED = "EXPIRED", REJECTED = "REJECTED" } export declare enum TicketLegalHoldReleaseReason { MATTER_CLOSED = "MATTER_CLOSED", NO_LONGER_RELEVANT = "NO_LONGER_RELEVANT", APPLIED_IN_ERROR = "APPLIED_IN_ERROR", SUPERSEDED = "SUPERSEDED", OBLIGATION_EXPIRED = "OBLIGATION_EXPIRED", OTHER = "OTHER" } export interface ITicketSecuritySubject { /** When every selector is false or empty, the subject matches nobody. */ allAuthenticated?: boolean; allAgents?: boolean; allCustomers?: boolean; userIds?: string[]; roleIds?: string[]; groupIds?: string[]; organizationIds?: string[]; contactSegmentIds?: string[]; includeTicketRequester?: boolean; includeAssignee?: boolean; includeGroupMembers?: boolean; } export interface ITicketSecurityScope { spaceIds?: string[]; brandIds?: string[]; organizationIds?: string[]; categoryIds?: string[]; assignedGroupIds?: string[]; channelIds?: string[]; sensitivityLevels?: TicketSensitivityLevel[]; } export interface ITicketSecurityCondition { fieldNameKey: string; operator: TicketConditionOperator; expectedValue?: TicketPropertyValue; } export interface ITicketSecurityConditionGroup { operator: TicketPolicyConditionGroupOperator; conditions?: ITicketSecurityCondition[]; groups?: ITicketSecurityConditionGroup[]; } export interface ITicketFieldPermission { fieldNameKey: string; operations: TicketSecurityOperation[]; effect: TicketPolicyEffect; maskingStrategy?: TicketMaskingStrategy; } export interface ITicketSecurityPolicy extends ITicketAuditedEntity { name: string; description?: string; enabled: boolean; priority: number; effect: TicketPolicyEffect; resourceTypes: TicketSecurityResourceType[]; operations: TicketSecurityOperation[]; subjects: ITicketSecuritySubject; scope?: ITicketSecurityScope; conditions?: ITicketSecurityConditionGroup; fieldPermissions?: ITicketFieldPermission[]; validFrom?: Date; validUntil?: Date; version: number; } export interface ICreateTicketSecurityPolicyDto { name: string; description?: string; enabled?: boolean; priority?: number; effect: TicketPolicyEffect; resourceTypes: TicketSecurityResourceType[]; operations: TicketSecurityOperation[]; subjects: ITicketSecuritySubject; scope?: ITicketSecurityScope; conditions?: ITicketSecurityConditionGroup; fieldPermissions?: ITicketFieldPermission[]; validFrom?: Date; validUntil?: Date; } export interface IUpdateTicketSecurityPolicyDto { expectedVersion: number; name?: string; description?: string; enabled?: boolean; priority?: number; effect?: TicketPolicyEffect; resourceTypes?: TicketSecurityResourceType[]; operations?: TicketSecurityOperation[]; subjects?: ITicketSecuritySubject; scope?: ITicketSecurityScope; conditions?: ITicketSecurityConditionGroup; fieldPermissions?: ITicketFieldPermission[]; validFrom?: Date; validUntil?: Date; } export interface ITicketFieldSecurityDefinition extends ITicketAuditedEntity { fieldNameKey: string; label: string; type: TicketFieldType; isSystem: boolean; enabled: boolean; classification?: TicketDataClassification; containsPii: boolean; maskingStrategy: TicketMaskingStrategy; searchableWhenMasked: boolean; exportable: boolean; retentionPolicyId?: string; readRoleIds?: string[]; writeRoleIds?: string[]; searchable: boolean; filterable: boolean; sortable: boolean; version: number; } export interface IUpdateTicketFieldSecurityDefinitionDto { expectedVersion: number; classification?: TicketDataClassification; containsPii?: boolean; maskingStrategy?: TicketMaskingStrategy; searchableWhenMasked?: boolean; exportable?: boolean; retentionPolicyId?: string; readRoleIds?: string[]; writeRoleIds?: string[]; searchable?: boolean; filterable?: boolean; sortable?: boolean; } export interface ITicketSecurityState { sensitivity: TicketSensitivityLevel; policyIds?: string[]; organizationId?: string; brandId?: string; restrictedGroupIds?: string[]; containsPii: boolean; legalHold: boolean; } export interface ITicketRedactionRequest { id: string; spaceId: string; ticketId: string; fieldNameKeys?: string[]; messageIds?: string[]; attachmentIds?: string[]; reason: string; requestedAt: Date; requestedBy: string; approvedAt?: Date; approvedBy?: string; status: TicketRedactionStatus; completedAt?: Date; error?: string; } export interface ITicketRetentionPolicy extends ITicketAuditedEntity { name: string; description?: string; retentionDays: number; action: TicketRetentionAction; categoryIds?: string[]; dataClassifications?: TicketDataClassification[]; preserveAuditLog: boolean; enabled: boolean; version: number; } export interface ICreateTicketRetentionPolicyDto { name: string; description?: string; retentionDays: number; action: TicketRetentionAction; categoryIds?: string[]; dataClassifications?: TicketDataClassification[]; preserveAuditLog?: boolean; enabled?: boolean; } export interface IUpdateTicketRetentionPolicyDto { expectedVersion: number; name?: string; description?: string; retentionDays?: number; action?: TicketRetentionAction; categoryIds?: string[]; dataClassifications?: TicketDataClassification[]; preserveAuditLog?: boolean; enabled?: boolean; } export interface ITicketRetentionUpcomingBucket { withinDays: number; count: number; } export interface ITicketRetentionAffectedCategory { categoryId: string; name: string; count: number; } export interface ITicketRetentionSampleTicket { ticketId: string; number: number; title: string; categoryId: string; resolvedAt: Date; } export interface ITicketRetentionImpactPreview { policyId?: string; action: TicketRetentionAction; retentionDays: number; preserveAuditLog: boolean; irreversible: boolean; anonymizedFieldNameKeys?: string[]; evaluatedAt: Date; alreadyReachedCount: number; onLegalHoldCount: number; upcoming: ITicketRetentionUpcomingBucket[]; affectedCategories: ITicketRetentionAffectedCategory[]; affectedClassifications: TicketDataClassification[]; samples: ITicketRetentionSampleTicket[]; } export interface ITicketRetentionValidationIssue { code: string; severity: 'ERROR' | 'WARNING'; message: string; path?: string; } export interface ITicketRetentionValidationEntry { policyId: string; issues: ITicketRetentionValidationIssue[]; } export interface IValidateTicketRetentionResponse { policies: ITicketRetentionValidationEntry[]; } export interface ITicketFieldSecurityValidationIssue { code: string; severity: 'ERROR' | 'WARNING'; message: string; path?: string; } export interface ITicketFieldSecurityValidationEntry { fieldNameKey: string; issues: ITicketFieldSecurityValidationIssue[]; } export interface IValidateTicketFieldSecurityResponse { fields: ITicketFieldSecurityValidationEntry[]; } export interface ITicketFieldSecurityPreviewRequest { roleIds: string[]; } export interface ITicketFieldSecurityPreviewEntry { fieldNameKey: string; label: string; visible: boolean; editable: boolean; masked: boolean; maskingStrategy?: TicketMaskingStrategy; searchable: boolean; exportable: boolean; } export interface ITicketFieldSecurityPreviewResponse { roleIds: string[]; fields: ITicketFieldSecurityPreviewEntry[]; } export interface ITicketLegalHold { id: string; spaceId: string; ticketId: string; name: string; reason: string; status: TicketLegalHoldStatus; placedAt: Date; placedBy: string; releasedAt?: Date; releasedBy?: string; externalMatterId?: string; releaseReason?: TicketLegalHoldReleaseReason; releaseNotes?: string; } export interface ITicketAccessAuditEvent { id: string; spaceId: string; ticketId?: string; actorId: string; effectiveUserId: string; action: TicketAccessAuditAction; resourceType: TicketSecurityResourceType; resourceId?: string; fieldNameKeys?: string[]; purpose?: string; ipAddress?: string; userAgent?: string; correlationId?: string; occurredAt: Date; allowed: boolean; enforced: boolean; policyIds?: string[]; denialReason?: string; technicalContextWithheld: boolean; } export interface ICreateTicketAccessAuditEventDto { actorId: string; /** Con qué identidad se actuó. Si no hay impersonación, es el propio actor. */ effectiveUserId?: string; action: TicketAccessAuditAction; resourceType: TicketSecurityResourceType; resourceId?: string; ticketId?: string; /** Qué campos se tocaron. NUNCA sus valores. */ fieldNameKeys?: string[]; purpose?: string; ipAddress?: string; userAgent?: string; correlationId?: string; allowed: boolean; enforced?: boolean; policyIds?: string[]; denialReason?: string; } export interface ITicketAccessAuditFilters { from?: Date; to?: Date; userId?: string; actorId?: string; effectiveUserId?: string; actions?: TicketAccessAuditAction[]; resourceTypes?: TicketSecurityResourceType[]; ticketId?: string; fieldNameKey?: string; allowed?: boolean; enforced?: boolean; policyId?: string; ipAddress?: string; correlationId?: string; } export interface ITicketAccessAuditSearchRequest extends ITicketAccessAuditFilters { cursor?: string; limit?: number; } export interface ITicketAccessAuditEventDetail { event: ITicketAccessAuditEvent; correlated: ITicketAccessAuditEvent[]; } export interface ITicketAccessAuditExportPreview { filters: ITicketAccessAuditFilters; from?: Date; to?: Date; estimatedEventCount: number; includesSensitiveData: boolean; includedActions: TicketAccessAuditAction[]; wideRangeWarning?: string; } export interface ITicketImpersonationSession { id: string; spaceId: string; actorId: string; impersonatedUserId: string; reason: string; approvedBy?: string; startedAt: Date; expiresAt: Date; endedAt?: Date; } export interface ITicketDelegatedAccess { id: string; spaceId: string; grantorId: string; delegateId: string; operations: TicketSecurityOperation[]; scope?: ITicketSecurityScope; status: TicketDelegatedAccessStatus; reason?: string; requestedAt: Date; startsAt: Date; expiresAt: Date; approvedBy?: string; revokedAt?: Date; revokedBy?: string; } export interface ITicketAuthorizationRequest { actorId: string; effectiveUserId?: string; operation: TicketSecurityOperation; resourceType: TicketSecurityResourceType; resourceId?: string; ticketId?: string; fieldNameKeys?: string[]; context?: { [key: string]: TicketPropertyValue; }; evaluatedAt?: Date; subjectContext?: ITicketAuthorizationSubjectContext; ticketContext?: ITicketAuthorizationTicketContext; record?: boolean; purpose?: string; } export interface ITicketAuthorizationSubjectContext { isAgent?: boolean; isCustomer?: boolean; roleIds?: string[]; groupIds?: string[]; organizationIds?: string[]; contactSegmentIds?: string[]; } export interface ITicketAuthorizationTicketContext { requesterId?: string; assigneeId?: string; assignedGroupId?: string; categoryId?: string; channelId?: string; brandId?: string; organizationId?: string; sensitivityLevel?: TicketSensitivityLevel; fields?: { [nameKey: string]: TicketPropertyValue; }; } export interface ITicketAuthorizationDecision { allowed: boolean; policyIds: string[]; decisivePolicyId?: string; deniedFieldNameKeys?: string[]; maskedFieldNameKeys?: string[]; reason?: string; evaluatedAt: Date; } export interface ITicketSecurityPolicyValidationIssue { code: string; severity: 'ERROR' | 'WARNING'; message: string; path?: string; } export interface IValidateTicketSecurityPolicyResponse { issues: ITicketSecurityPolicyValidationIssue[]; } export interface ICreateTicketRedactionRequestDto { expectedVersion: number; fieldNameKeys?: string[]; messageIds?: string[]; attachmentIds?: string[]; reason: string; } export interface ICreateTicketLegalHoldDto { expectedVersion: number; name: string; reason: string; externalMatterId?: string; } export interface IReleaseTicketLegalHoldDto { expectedVersion: number; releaseReason: TicketLegalHoldReleaseReason; releaseNotes?: string; } export interface ITicketSuspendedRetentionPolicy { id: string; name: string; action: TicketRetentionAction; retentionDays: number; } export interface ITicketLegalHoldsResponse { onHold: boolean; holds: ITicketLegalHold[]; suspendedPolicies: ITicketSuspendedRetentionPolicy[]; } export interface ITicketLegalHoldListEntry extends ITicketLegalHold { ticketNumber: number; ticketTitle: string; } export interface ICreateTicketDelegatedAccessDto { delegateId: string; operations: TicketSecurityOperation[]; scope?: ITicketSecurityScope; reason?: string; startsAt: Date; expiresAt: Date; } export interface IStartTicketImpersonationDto { impersonatedUserId: string; reason: string; expiresAt: Date; } export type TicketAccessAuditPage = ITicketCursorResponse;