import { apiGet } from "@/api/client";

export interface FulfillmentStat {
  label: string;
  value: string;
  tone?: string | null;
}

export interface FulfillmentTimelineItem {
  time: string;
  title: string;
  tone: string;
}

export interface FulfillmentStageLoad {
  label: string;
  value: string;
}

export interface FulfillmentOverviewResponse {
  throughput_total: string;
  stats: FulfillmentStat[];
  timeline: FulfillmentTimelineItem[];
  stage_load: FulfillmentStageLoad[];
}

export interface FulfillmentTask {
  id: string;
  order_id: string;
  title: string;
  assignee: string;
  stage: string;
  status: string;
  priority: string;
  sla: string;
}

export interface FulfillmentNote {
  id: string;
  note: string;
  emphasis: string;
}

export interface FulfillmentBoardResponse {
  tasks: FulfillmentTask[];
  notes: FulfillmentNote[];
}

export function fetchFulfillmentOverview(accessToken: string) {
  return apiGet<FulfillmentOverviewResponse>("/fulfillment/overview", { accessToken });
}

export function fetchFulfillmentBoard(accessToken: string) {
  return apiGet<FulfillmentBoardResponse>("/fulfillment/board", { accessToken });
}
