import { Priority, WorkflowStatus } from './common.types';

export interface WorkflowRequest {
  requestId: string;
  requestNumber: string;
  initiatorId: string;
  templateType: 'CUSTOM' | 'TEMPLATE' | 'DEALER CLAIM' | 'FORM_16';
  workflowType?: string;
  title: string;
  description: string;
  priority: Priority;
  status: WorkflowStatus;
  currentLevel: number;
  totalLevels: number;
  totalTatHours: number;
  submissionDate?: Date;
  closureDate?: Date;
  conclusionRemark?: string;
  aiGeneratedConclusion?: string;
  isDraft: boolean;
  isDeleted: boolean;
  createdAt: Date;
  updatedAt: Date;
}

export interface CreateWorkflowRequest {
  templateType: 'CUSTOM' | 'TEMPLATE' | 'DEALER CLAIM' | 'FORM_16';
  workflowType?: string;
  title: string;
  description: string;
  priority: Priority;
  approvalLevels: CreateApprovalLevel[];
  participants?: CreateParticipant[];
  isDraft?: boolean;
  skipCreation?: boolean; // Flag to skip record creation if handled manually by calling service
}

export interface UpdateWorkflowRequest {
  title?: string;
  description?: string;
  priority?: Priority;
  status?: WorkflowStatus;
  conclusionRemark?: string;
  // For draft updates - full workflow structure
  approvalLevels?: CreateApprovalLevel[];
  participants?: CreateParticipant[];
  // Document updates (add new documents via multipart, delete via IDs)
  deleteDocumentIds?: string[];
  isDraft?: boolean;
}

export interface CreateApprovalLevel {
  levelNumber: number;
  levelName?: string;
  approverId: string;
  approverEmail: string;
  approverName: string;
  tatHours: number;
  isFinalApprover?: boolean;
}

export interface CreateParticipant {
  userId: string;
  userEmail: string;
  userName: string;
  participantType: 'INITIATOR' | 'APPROVER' | 'SPECTATOR';
  canComment?: boolean;
  canViewDocuments?: boolean;
  canDownloadDocuments?: boolean;
  notificationEnabled?: boolean;
}
