import type { Meta, StoryObj } from "@storybook/react-vite";
import { DraftInfoCard } from "./DraftInfoCard";

const meta: Meta<typeof DraftInfoCard> = {
  title: "League/DraftInfoCard",
  component: DraftInfoCard,
  parameters: {
    layout: "padded",
  },
};

export default meta;
type Story = StoryObj<typeof DraftInfoCard>;

const base = {
  draftRounds: 8,
  draftTimerMode: "chess_clock" as const,
  draftInitialTime: 120,   // 2:00 bank
  draftIncrementTime: 15,  // +0:15 per pick
  sportsCount: 3,
  isDraftOrderSet: false,
  isDraftOrPreDraft: true,
  draftBoardHref: "/leagues/1/draft-board/1",
  draftRoomHref: "/leagues/1/draft/1",
};

export const PreDraftInProgress: Story = {
  args: {
    ...base,
    draftDateTime: new Date("2025-06-14T19:00:00"),
  },
};

export const PreDraftOrderSet: Story = {
  args: {
    ...base,
    isDraftOrderSet: true,
    draftDateTime: new Date("2025-06-14T19:00:00"),
  },
};

export const PreDraftNoDate: Story = {
  args: {
    ...base,
  },
};

export const StandardTimer: Story = {
  args: {
    ...base,
    draftTimerMode: "standard",
    draftInitialTime: 90,
    draftIncrementTime: 90,
    isDraftOrderSet: true,
    draftDateTime: new Date("2025-06-14T19:00:00"),
  },
};

export const StandardTimerLong: Story = {
  name: "Standard Timer (slow league — 1 day/pick)",
  args: {
    ...base,
    draftTimerMode: "standard",
    draftInitialTime: 86400,
    draftIncrementTime: 86400,
    isDraftOrderSet: true,
    draftDateTime: new Date("2025-06-14T19:00:00"),
  },
};

export const ChessClockSlow: Story = {
  name: "Chess Clock (slow — 8h bank, 1h increment)",
  args: {
    ...base,
    draftInitialTime: 28800,
    draftIncrementTime: 3600,
    isDraftOrderSet: true,
    draftDateTime: new Date("2025-06-14T19:00:00"),
  },
};

export const WithDraftPosition: Story = {
  name: "4 panels — draft position set (pick 3)",
  args: {
    ...base,
    isDraftOrderSet: true,
    draftDateTime: new Date("2025-06-14T19:00:00"),
    userDraftPosition: 3,
  },
};

export const NonCommissionerView: Story = {
  name: "Non-commissioner (no Set Order CTA)",
  args: {
    ...base,
    draftDateTime: new Date("2025-06-14T19:00:00"),
  },
};

export const ActiveSeason: Story = {
  name: "Active season — bare historical view",
  args: {
    draftRounds: 8,
    draftTimerMode: "chess_clock",
    draftInitialTime: 120,
    draftIncrementTime: 15,
    sportsCount: 3,
    isDraftOrderSet: true,
    isDraftOrPreDraft: false,
    draftDateTime: new Date("2025-03-01T14:00:00"),
    draftBoardHref: "/leagues/1/draft-board/1",
    draftRoomHref: "/leagues/1/draft/1",
  },
};

export const ActiveSeasonStandard: Story = {
  name: "Active season — bare, standard timer",
  args: {
    draftRounds: 10,
    draftTimerMode: "standard",
    draftInitialTime: 90,
    draftIncrementTime: 90,
    sportsCount: 6,
    isDraftOrderSet: true,
    isDraftOrPreDraft: false,
    draftDateTime: new Date("2025-03-01T14:00:00"),
    draftBoardHref: "/leagues/1/draft-board/1",
    draftRoomHref: "/leagues/1/draft/1",
  },
};

export const ActiveSeasonNoDate: Story = {
  name: "Active season — bare, no draft date",
  args: {
    draftRounds: 8,
    draftTimerMode: "chess_clock",
    draftInitialTime: 120,
    draftIncrementTime: 15,
    sportsCount: 3,
    isDraftOrderSet: true,
    isDraftOrPreDraft: false,
    draftBoardHref: "/leagues/1/draft-board/1",
    draftRoomHref: "/leagues/1/draft/1",
  },
};
