export type SubmissionKind = "homework" | "critique"

export type SubmissionStatus = "awaiting_payment" | "pending" | "reviewed" | "cancelled"

export interface CritiqueScoreDto {
  key: string
  label: string
  score: number
}

export interface CritiquePinDto {
  number: number
  /** 0–1 from the artwork's left edge. */
  x: number
  /** 0–1 from the artwork's top edge. */
  y: number
  text: string
}

export interface CritiqueDto {
  scores: CritiqueScoreDto[]
  average: number | null
  summary: string | null
  /** Short-lived signed link to the coach's voice note, or null. */
  voice: string | null
  pins: CritiquePinDto[]
}

/** Mirrors the backend's SubmissionResource (GET/POST /v1/submissions). */
export interface SubmissionDto {
  id: number
  kind: SubmissionKind
  kind_label: string
  status: SubmissionStatus
  status_label: string
  title: string
  note: string | null
  price: number | null
  /** Short-lived signed link to the artwork (private disk). */
  artwork: string | null
  coach: { name: string; slug: string | null; avatar: string | null } | null
  course: { id: number; title: string } | null
  lesson: { id: number; title: string } | null
  parent_id: number | null
  /** Set while a paid critique waits for payment: open the purchase page with it. */
  purchase: {
    type: "critique"
    id: number
    payment_status: "pending" | "paid" | null
    payment_method: "manual" | "ipg" | "wallet" | null
  } | null
  submitted_at: string | null
  reviewed_at: string | null
  created_at: string
  critique: CritiqueDto | null
  /** Its gallery piece, once shared. */
  gallery?: { id: number; status: string; status_label: string } | null
}

