import { type Meta, type StoryObj } from '@storybook/react';

import ScoreDifferenceIndicator from '../ScoreDifferenceIndicator';

import SatisfactionDrawerStats from './index';

const meta: Meta<typeof SatisfactionDrawerStats> = {
  title:
    'Composed Components/PeopleExperience/SurveyResults/Satisfaction/SatisfactionDrawerStats',
  component: SatisfactionDrawerStats,
  parameters: {
    layout: 'centered',
  },
  args: {
    score: 85,
    scoreDifferenceIndicator: null,
    answers: 1234,
    comments: 456,
    format: 'Likert Scale',
  },
};

export default meta;

type Story = StoryObj<typeof SatisfactionDrawerStats>;

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

export const WithCustomLabels: Story = {
  args: {
    ...meta.args,
    scoreLabel: 'Puntuación',
    answersLabel: 'Respuestas',
    commentsLabel: 'Comentarios',
    formatLabel: 'Formato',
  },
};

export const LowNumbers: Story = {
  args: {
    ...meta.args,
    score: 42,
    answers: 50,
    comments: 12,
    format: 'Multiple Choice',
  },
};

export const HighNumbers: Story = {
  args: {
    ...meta.args,
    score: 98,
    answers: 12345,
    comments: 6789,
    format: 'Rating Scale',
  },
};

export const NoComments: Story = {
  args: {
    ...meta.args,
    score: 75,
    answers: 500,
    comments: 0,
    format: 'Yes/No',
  },
};

export const VeryHighNumbers: Story = {
  args: {
    ...meta.args,
    score: 100,
    answers: 1234567,
    comments: 987654,
    format: 'Open Text',
  },
};

export const NeutralScore: Story = {
  args: {
    ...meta.args,
    score: 50,
    answers: 2500,
    comments: 350,
    format: 'Matrix',
  },
};

export const WithPositiveScoreDifference: Story = {
  args: {
    ...meta.args,
    score: 78,
    scoreDifferenceIndicator: (
      <ScoreDifferenceIndicator
        difference={12}
        popoverMeta={{
          score: 78,
          baseScore: 66,
          scoreLabel: 'Current Score',
          baseScoreLabel: 'Previous Score',
          footerLabel: 'Comparison with previous period',
          scoreDifferenceDescription: 'The score increased by 12 points',
        }}
      />
    ),
    answers: 1500,
    comments: 320,
    format: 'Likert Scale',
  },
};

export const WithNegativeScoreDifference: Story = {
  args: {
    ...meta.args,
    score: 65,
    scoreDifferenceIndicator: (
      <ScoreDifferenceIndicator
        difference={-8}
        popoverMeta={{
          score: 65,
          baseScore: 73,
          scoreLabel: 'Current Score',
          baseScoreLabel: 'Previous Score',
          footerLabel: 'Comparison with previous period',
          scoreDifferenceDescription: 'The score decreased by 8 points',
        }}
      />
    ),
    answers: 2000,
    comments: 450,
    format: 'Rating Scale',
  },
};

export const WithZeroScoreDifference: Story = {
  args: {
    ...meta.args,
    score: 72,
    scoreDifferenceIndicator: (
      <ScoreDifferenceIndicator
        difference={0}
        popoverMeta={{
          score: 72,
          baseScore: 72,
          scoreLabel: 'Current Score',
          baseScoreLabel: 'Previous Score',
          footerLabel: 'Comparison with previous period',
          scoreDifferenceDescription: 'The score remained the same',
        }}
      />
    ),
    answers: 1800,
    comments: 280,
    format: 'Multiple Choice',
  },
};

export const WithNullScoreDifference: Story = {
  args: {
    ...meta.args,
    score: 68,
    scoreDifferenceIndicator: null,
    answers: 950,
    comments: 175,
    format: 'Open Text',
  },
};
