export type BoardAutomationType = string;

export type BoardAttachment = {
  id: string;
  name: string;
  path: string;
  publicUrl: string;
  size: number;
  mimeType: string;
};

export type BoardRequestExecutionMode = 'all_at_once' | 'after_previous_finished' | 'after_previous_success';

export type BoardRequestItem = {
  id: number;
  boardPostId: number;
  sequence: number;
  title: string;
  content: string;
  planItemId: number | null;
  automationReceivedAt: string | null;
  workflowState: 'pending' | 'waiting' | 'registered' | 'completed' | 'failed' | 'blocked';
  status: 'pending' | 'waiting' | 'queued' | 'in_progress' | 'completed' | 'failed' | 'blocked';
  statusLabel: string;
  planStatus: string | null;
  workerStatus: string | null;
  lastError: string | null;
  createdAt: string;
  updatedAt: string;
};

export type BoardPost = {
  id: number;
  title: string;
  content: string;
  preview: string;
  attachments: BoardAttachment[];
  automationType: BoardAutomationType;
  automationPlanItemId: number | null;
  automationReceivedAt: string | null;
  automationContextIds?: string[];
  requestExecutionMode: BoardRequestExecutionMode;
  requestItems: BoardRequestItem[];
  requestSummary: {
    total: number;
    completed: number;
    failed: number;
    running: number;
    queued: number;
    waiting: number;
    blocked: number;
  };
  createdAt: string;
  updatedAt: string;
};

export type BoardDraft = {
  id: number | null;
  title: string;
  content: string;
  attachments: BoardAttachment[];
  automationType: BoardAutomationType;
  requestExecutionMode: BoardRequestExecutionMode;
  requestItems: Array<{
    key: string;
    title: string;
    content: string;
  }>;
};
