import {
  ReturnProcessQuestion,
  ReturnProcessQuestionKey,
  ReturnProcessQuestionType,
} from '../models';
import { ItemConditionAnswer, ReturnReasonAnswer } from './constants';

/**
 * Questions for the return process of books and calendars.
 *
 * This array defines the flow of questions presented to users when processing
 * book or calendar returns. The questions follow a branching logic based on
 * the user's answers, guiding them through the appropriate return process.
 *
 * The flow typically starts with checking the item condition, then asks about
 * the return reason, and may request additional information depending on the
 * reason selected.
 */
export const bookCalendarQuestions: ReturnProcessQuestion[] = [
  {
    key: ReturnProcessQuestionKey.ItemCondition,
    description: 'Wie ist der Artikelzustand?',
    type: ReturnProcessQuestionType.Select,
    options: [
      {
        label: 'Neuwertig/Originalverpackt',
        value: ItemConditionAnswer.OVP,
        nextQuestion: ReturnProcessQuestionKey.ReturnReason,
        returnInfo: { itemCondition: 'Neuwertig/Originalverpackt' },
      },
      {
        label: 'Beschädigt/Fehldruck',
        value: ItemConditionAnswer.Damaged,
        returnInfo: { itemCondition: 'Beschädigt/Fehldruck' },
      },
    ],
  },
  {
    key: ReturnProcessQuestionKey.ReturnReason,
    description: 'Warum möchtest du den Artikel zurücksenden?',
    type: ReturnProcessQuestionType.Select,
    options: [
      {
        label: 'Gefällt nicht/Widerruf',
        value: ReturnReasonAnswer.Dislike,
        returnInfo: { returnReason: 'Gefällt nicht/Widerruf' },
      },
      {
        label: 'Fehllieferung',
        value: ReturnReasonAnswer.WrongItem,
        nextQuestion: ReturnProcessQuestionKey.DeliveredItem,
        returnInfo: { returnReason: 'Fehllieferung' },
      },
    ],
  },
  {
    key: ReturnProcessQuestionKey.DeliveredItem,
    description: 'Welcher Artikel wurde geliefert?',
    type: ReturnProcessQuestionType.Product,
  },
];
