export type SseEventType =
  | 'task_updated'
  | 'message_delta'
  | 'message_completed'
  | 'card_created'
  | 'error'
  | 'completed';

export interface ChatMessage {
  id: string;
  role: 'user' | 'assistant' | 'system';
  content: string;
  streaming?: boolean;
  timestamp?: string;
  _seq?: number;
  _type?: string;
}

export interface CardAction {
  actionName: string;
  label?: string;
  requiredConfirm?: boolean;
}

export interface CardInstance {
  cardInstanceId: string;
  cardKey:
    | 'department-selection'
    | 'doctor-selection'
    | 'time-slot-selection'
    | 'confirm-appointment'
    | 'payment-qrcode'
    | 'appointment-success'
    | 'route-card'
    | 'tongue-capture'
    | string;
  status: 'active' | 'submitted' | 'processing' | 'completed' | 'expired' | 'failed';
  expiresAt?: string;
  cardData: Record<string, unknown>;
  actions: CardAction[];
}

export interface TaskState {
  taskId: string;
  taskType: 'REGISTRATION' | 'GUIDE' | 'TRIAGE' | 'TONGUE_DIAGNOSIS' | string;
  currentStep: string;
  status: 'ACTIVE' | 'WAITING_CARD_ACTION' | 'PROCESSING' | 'COMPLETED' | 'CANCELLED' | 'FAILED' | string;
}
