import { v4 as uuidv4 } from 'uuid';

// Storybook setup
import { Meta, Story } from '@storybook/react';
import React from 'react';
import {
  getMockedPlayersRowsLeader,
  getMockedPlayersRowsNotLeader,
} from '../../../components/PartySystem';
import {
  IPartyManagerProps,
  PartyManager,
} from '../../../components/PartySystem/PartyManager/PartyManager';
import { RPGUIRoot } from '../../../components/RPGUI/RPGUIRoot';

const meta: Meta = {
  title: 'Features/Party System/Party Manager',
  component: PartyManager,
};

export default meta;

const Template: Story<IPartyManagerProps> = args => (
  <RPGUIRoot>
    <PartyManager {...args} />
  </RPGUIRoot>
);
// Assume this is your user ID
const yourUserId = uuidv4();

// Story where you are the leader
export const YouAreLeader = Template.bind({});
YouAreLeader.args = {
  partyRows: getMockedPlayersRowsLeader(yourUserId),
  userId: yourUserId,
  onRemovePlayer: (id: string) => console.log(`Remove player with ID: ${id}`),
  onChangeLeader: (id: string) => console.log(`Change leader to ID: ${id}`),
};

// Story where you are not the leader
export const YouAreNotLeader = Template.bind({});
YouAreNotLeader.args = {
  partyRows: getMockedPlayersRowsNotLeader(yourUserId),
  userId: yourUserId,
  onRemovePlayer: (id: string) => console.log(`Remove player with ID: ${id}`),
  onChangeLeader: (id: string) => console.log(`Change leader to ID: ${id}`),
};
