import { useTheme } from '@mui/material';
import { type Meta, type StoryObj } from '@storybook/react-vite';

import MidCircle from '.';

const meta: Meta<typeof MidCircle> = {
  component: MidCircle,
  title: 'Composed Components/Charts/MidCircle',
  tags: ['autodocs'],
  args: {
    current: 25,
    copetin: 'Copetin',
    title: 'Title here',
    description: 'Some description',
  },
  argTypes: {
    color: {
      control: { type: 'color' },
    },
    decimalPrecision: {
      options: [0, 1, 2],
      control: { type: 'radio' },
    },
  },
};

export default meta;

type Story = StoryObj<typeof MidCircle>;

export const Default: Story = {
  args: {},
};

export const NoText: Story = {
  args: {
    copetin: undefined,
    title: undefined,
    description: undefined,
  },
};

export const DecimalPrecision: Story = {
  args: {
    decimalPrecision: 2,
  },
};

export const Color: Story = {
  render: args => {
    const theme = useTheme();
    return (
      <MidCircle
        {...args}
        color={theme.palette.newBase?.green[600]}
      />
    );
  },
  args: {},
};

export const Loading: Story = {
  args: {
    loading: true,
  },
};

export const NoTextLoading: Story = {
  args: {
    copetin: undefined,
    title: undefined,
    description: undefined,
    loading: true,
  },
};
