import type { Row } from "../lib/types";

const timestamp = new Date("2024-01-01T00:00:00.000Z");

export const basePipeline = {
  id: "pipeline-1",
  name: "Delivery Pipeline",
  description: "Primary pipeline",
  pipelineType: "TASK_BOARD",
  createdByUserId: "user-1",
  status: "ACTIVE",
  locked: false,
  itemNumberSeq: null,
  createdAt: timestamp,
  updatedAt: null,
} as const satisfies Row<"Pipeline">;

export const archivedPipeline = {
  ...basePipeline,
  id: "pipeline-archived",
  status: "ARCHIVED",
} as const satisfies Row<"Pipeline">;

export const lockedPipeline = {
  ...basePipeline,
  id: "pipeline-locked",
  pipelineType: "SUPPORT_QUEUE",
  locked: true,
} as const satisfies Row<"Pipeline">;

export const baseStage = {
  id: "stage-1",
  pipelineId: basePipeline.id,
  name: "Backlog",
  position: 1,
  category: "NOT_STARTED",
  color: "#0ea5e9",
  createdAt: timestamp,
  updatedAt: null,
} as const satisfies Row<"PipelineStage">;

export const inProgressStage = {
  ...baseStage,
  id: "stage-2",
  name: "In Progress",
  position: 2,
  category: "IN_PROGRESS",
} as const satisfies Row<"PipelineStage">;

export const doneStage = {
  ...baseStage,
  id: "stage-3",
  name: "Done",
  position: 3,
  category: "DONE",
} as const satisfies Row<"PipelineStage">;

export const canceledStage = {
  ...baseStage,
  id: "stage-4",
  name: "Canceled",
  position: 4,
  category: "CANCELED",
} as const satisfies Row<"PipelineStage">;

export const baseItem = {
  id: "item-1",
  pipelineId: basePipeline.id,
  stageId: baseStage.id,
  title: "Prepare kickoff deck",
  description: "Collect current pipeline scope",
  assigneeId: "user-2",
  priority: "MEDIUM",
  dueDate: new Date("2024-01-10T00:00:00.000Z"),
  position: 1,
  itemNumber: 1,
  lifecycle: "OPEN",
  createdAt: timestamp,
  updatedAt: null,
} as const satisfies Row<"PipelineItem">;

export const closedItem = {
  ...baseItem,
  id: "item-closed",
  stageId: doneStage.id,
  lifecycle: "CLOSED",
} as const satisfies Row<"PipelineItem">;

export const draftItem = {
  ...baseItem,
  id: "item-draft",
  lifecycle: "DRAFT",
} as const satisfies Row<"PipelineItem">;

export const basePipelineStageTransition = {
  id: "transition-1",
  itemId: baseItem.id,
  fromStageId: baseStage.id,
  toStageId: inProgressStage.id,
  movedByUserId: "user-1",
  createdAt: timestamp,
  updatedAt: null,
} as const satisfies Row<"PipelineStageTransition">;

export const basePipelineItemComment = {
  id: "comment-1",
  itemId: baseItem.id,
  authorUserId: "user-1",
  body: "Looks good to me",
  createdAt: timestamp,
  updatedAt: null,
} as const satisfies Row<"PipelineItemComment">;

export const baseLabel = {
  id: "label-1",
  pipelineId: basePipeline.id,
  name: "urgent",
  color: "#EF4444",
  description: "Items requiring urgent attention",
  createdAt: timestamp,
  updatedAt: null,
} as const satisfies Row<"PipelineLabel">;

export const otherPipelineLabel = {
  ...baseLabel,
  id: "label-other",
  pipelineId: "pipeline-other",
  name: "other-pipeline-label",
} as const satisfies Row<"PipelineLabel">;

export const basePipelineItemLabel = {
  id: "item-label-1",
  itemId: baseItem.id,
  labelId: baseLabel.id,
  createdAt: timestamp,
  updatedAt: null,
} as const satisfies Row<"PipelineItemLabel">;
