export const POST_JOB_STATUS = { QUEUED: "รอคิว", RUNNING: "กำลังสร้าง", COMPLETED: "พร้อมตรวจฉบับร่าง", FAILED: "สร้างไม่สำเร็จ", CANCELLED: "ยกเลิกแล้ว", } as const; export const POST_JOB_STAGE: Record = { queued: "รอเริ่มสร้างโพสต์", content: "Codex กำลังเขียนเนื้อหาและพรอมต์ภาพ", image: "ChatGPT กำลังสร้างภาพ", saving: "กำลังบันทึกฉบับร่าง", }; export interface PostJobView { id: string; topic: string; status: keyof typeof POST_JOB_STATUS; stage: string; postId: string | null; error: string | null; createdAt: string; startedAt: string | null; finishedAt: string | null; } /** Milestones, not an estimate of the image model's internal rendering progress. */ export function postJobProgress(job: Pick): number { if (job.status === "COMPLETED") return 100; if (job.status === "QUEUED" || job.status === "CANCELLED") return 0; return ({ content: 10, image: 50, saving: 90 } as Record)[job.stage] ?? 0; }