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

/**
 * Questions for the return process of Ton-/Datenträger (audio/data carriers).
 * This array defines the sequence and logic flow of questions presented to users
 * when processing audio or data carrier returns in the system.
 *
 * The question flow for audio/data carriers is specifically designed to handle
 * the unique return policies that apply to these products:
 * - Sealed items are typically eligible for return
 * - Opened items may be eligible if they're defective
 * - Opened, non-defective items might be subject to different return policies
 *
 * Each question has a unique key, descriptive text, question type, and possible options
 * with their corresponding next question in the flow.
 */
export const tonDatentraegerQuestions: ReturnProcessQuestion[] = [
  {
    key: ReturnProcessQuestionKey.ItemCondition,
    description: 'Wie ist der Artikelzustand?',
    type: ReturnProcessQuestionType.Select,
    options: [
      {
        label: 'Versiegelt/Originalverpackt',
        value: ItemConditionAnswer.OVP,
        returnInfo: { itemCondition: 'Originalverpackt' },
        nextQuestion: ReturnProcessQuestionKey.ReturnReason,
      },
      {
        label: 'Geöffnet',
        value: ItemConditionAnswer.Damaged,
        nextQuestion: ReturnProcessQuestionKey.ItemDefective,
      },
    ],
  },
  {
    key: ReturnProcessQuestionKey.ItemDefective,
    description: 'Ist der Artikel Defekt?',
    type: ReturnProcessQuestionType.Select,
    options: [
      {
        label: 'Ja',
        value: YesNoAnswer.Yes,
        returnInfo: {
          itemCondition: 'Geöffnet/Defekt',
          returnReason: 'Geöffnet/Defekt',
        },
      },
      {
        label: 'Nein',
        value: YesNoAnswer.No,
        returnInfo: {
          itemCondition: 'Geöffnet/Ok',
          returnReason: 'Geöffnet/Ok',
        },
      },
    ],
  },
  {
    key: ReturnProcessQuestionKey.ReturnReason,
    description: 'Warum möchtest du den Artikel zurückgeben?',
    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,
  },
];
