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

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

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

export const TopThreePodium: Story = {
  args: {
    entries: [
      {
        teamId: "t1",
        teamName: "Lightning Wolves",
        ownerName: "alice",
        displayRank: 1,
        currentRank: 1,
        points: 2810,
        href: "/leagues/1/standings/1/teams/t1",
      },
      {
        teamId: "t2",
        teamName: "Shadow Hawks",
        ownerName: "bob",
        displayRank: 2,
        currentRank: 2,
        points: 2654.5,
        href: "/leagues/1/standings/1/teams/t2",
      },
      {
        teamId: "t3",
        teamName: "Iron Eagles",
        ownerName: "carol",
        displayRank: 3,
        currentRank: 3,
        points: 2493,
        href: "/leagues/1/standings/1/teams/t3",
      },
    ],
  },
};

export const FullLeague: Story = {
  args: {
    entries: [
      {
        teamId: "t1",
        teamName: "Lightning Wolves",
        ownerName: "alice",
        displayRank: 1,
        currentRank: 1,
        points: 2810,
        rankChange: 2,
        pointChange: 87.5,
        href: "/leagues/1/standings/1/teams/t1",
      },
      {
        teamId: "t2",
        teamName: "Shadow Hawks",
        ownerName: "bob",
        displayRank: 2,
        currentRank: 2,
        points: 2654.5,
        rankChange: 0,
        pointChange: 42.0,
        href: "/leagues/1/standings/1/teams/t2",
      },
      {
        teamId: "t3",
        teamName: "Iron Eagles",
        ownerName: "carol",
        displayRank: 3,
        currentRank: 3,
        points: 2493,
        rankChange: -1,
        pointChange: -12.3,
        href: "/leagues/1/standings/1/teams/t3",
      },
      {
        teamId: "t4",
        teamName: "Cyber Foxes",
        ownerName: "dave",
        displayRank: 4,
        currentRank: 4,
        points: 2311.8,
        rankChange: 1,
        pointChange: 23.1,
        href: "/leagues/1/standings/1/teams/t4",
      },
      {
        teamId: "t5",
        teamName: "Neon Tigers",
        ownerName: "eve",
        displayRank: 5,
        currentRank: 5,
        points: 2108,
        rankChange: -2,
        pointChange: -55.0,
        href: "/leagues/1/standings/1/teams/t5",
      },
      {
        teamId: "t6",
        teamName: "Phantom Sharks",
        ownerName: "frank",
        displayRank: 6,
        currentRank: 6,
        points: 1987.3,
        rankChange: 0,
        pointChange: 0,
        href: "/leagues/1/standings/1/teams/t6",
      },
      {
        teamId: "t7",
        teamName: "Crimson Tide FC",
        ownerName: "grace",
        displayRank: 7,
        currentRank: 7,
        points: 1834,
        href: "/leagues/1/standings/1/teams/t7",
      },
      {
        teamId: "t8",
        teamName: "Arctic Wolves United",
        ownerName: "hank",
        displayRank: 8,
        currentRank: 8,
        points: 1692.6,
        href: "/leagues/1/standings/1/teams/t8",
      },
    ],
  },
};

export const WithTies: Story = {
  args: {
    entries: [
      {
        teamId: "t1",
        teamName: "Lightning Wolves",
        ownerName: "alice",
        displayRank: "T1",
        currentRank: 1,
        points: 2810,
        href: "/leagues/1/standings/1/teams/t1",
      },
      {
        teamId: "t2",
        teamName: "Shadow Hawks",
        ownerName: "bob",
        displayRank: "T1",
        currentRank: 1,
        points: 2810,
        href: "/leagues/1/standings/1/teams/t2",
      },
      {
        teamId: "t3",
        teamName: "Iron Eagles",
        ownerName: "carol",
        displayRank: "T3",
        currentRank: 3,
        points: 2493,
        href: "/leagues/1/standings/1/teams/t3",
      },
      {
        teamId: "t4",
        teamName: "Cyber Foxes",
        ownerName: "dave",
        displayRank: "T3",
        currentRank: 3,
        points: 2493,
        href: "/leagues/1/standings/1/teams/t4",
      },
    ],
  },
};

export const AllUnranked: Story = {
  args: {
    entries: [
      {
        teamId: "t1",
        teamName: "Lightning Wolves",
        ownerName: "alice",
        displayRank: "T1",
        points: 0,
        href: "/leagues/1/standings/1/teams/t1",
      },
      {
        teamId: "t2",
        teamName: "Shadow Hawks",
        ownerName: "bob",
        displayRank: "T1",
        points: 0,
        href: "/leagues/1/standings/1/teams/t2",
      },
      {
        teamId: "t3",
        teamName: "Iron Eagles",
        ownerName: "carol",
        displayRank: "T1",
        points: 0,
        href: "/leagues/1/standings/1/teams/t3",
      },
    ],
  },
};

export const NoOwnerNames: Story = {
  args: {
    entries: [
      {
        teamId: "t1",
        teamName: "Lightning Wolves",
        displayRank: 1,
        currentRank: 1,
        points: 2810,
      },
      {
        teamId: "t2",
        teamName: "Shadow Hawks",
        displayRank: 2,
        currentRank: 2,
        points: 2654.5,
      },
      {
        teamId: "t3",
        teamName: "Iron Eagles",
        displayRank: 3,
        currentRank: 3,
        points: 2493,
      },
    ],
  },
};

export const LongTeamNames: Story = {
  args: {
    entries: [
      {
        teamId: "t1",
        teamName: "The Unstoppable Championship Winning Lightning Wolves",
        ownerName: "alice_with_a_really_long_username",
        displayRank: 1,
        currentRank: 1,
        points: 2810,
        href: "/leagues/1/standings/1/teams/t1",
      },
      {
        teamId: "t2",
        teamName: "Shadow Hawks of the Northern Division",
        ownerName: "bob",
        displayRank: 2,
        currentRank: 2,
        points: 2654.5,
        href: "/leagues/1/standings/1/teams/t2",
      },
    ],
  },
};
