import { TicketType } from "../common/common-types";
import { TicketTypeTarrifs } from "../common/common-enums";

const BASE_AMOUNT = 100;

export function getTicketPrice(data: TicketType) {
  const entryCoefficient = data.number_of_entries ? data.number_of_entries : 1;

  const basePrice = BASE_AMOUNT * entryCoefficient;

  switch (data.tariff) {
    case TicketTypeTarrifs.CHILDREN:
      return 0.2 * basePrice;
    case TicketTypeTarrifs.STUDENT:
      return 0.5 * basePrice;
    case TicketTypeTarrifs.ADULT:
      return basePrice;
    case TicketTypeTarrifs.SENIOR:
      return 0.2 * basePrice;
    default:
      return 0;
  }
}
