export const UnitType = {
  COUNT: 'COUNT',
  GRAM: 'GRAM',
  KILOGRAM: 'KILOGRAM',
  MILLILITER: 'MILLILITER',
  LITER: 'LITER',
  METER: 'METER',
  HOUR: 'HOUR',
} as const;

export type UnitType = (typeof UnitType)[keyof typeof UnitType];

export interface IUnitPreparedText {
  quantitySymbolText: string;
  quantityLabel: string;
}

const translates: Record<UnitType, string> = {
  COUNT: 'تعداد',
  GRAM: 'گرم',
  KILOGRAM: 'کیلوگرم',
  METER: 'متر',
  MILLILITER: 'میلی‌لیتر',
  LITER: 'لیتر',
  HOUR: 'ساعت',
};

export function getGoodUnitTypeProperties(unitType: UnitType): IUnitPreparedText {
  const data = {
    quantitySymbolText: translates[unitType],
    quantityLabel: '',
  };

  if (['COUNT'].includes(unitType)) {
    data.quantityLabel = 'تعداد';
  } else {
    data.quantityLabel = 'مقدار';
  }

  return data;
}
