enum EWeekDays {
  EWeekNone = 0x00,
  EWeekMonday = 0x01,
  EWeekTuesday = 0x02,
  EWeekWednesday = 0x04,
  EWeekThursday = 0x08,
  EWeekFriday = 0x10,
  EWeekSaturday = 0x20,
  EWeekSunday = 0x40,

  EWeekAll = EWeekMonday |
    EWeekTuesday |
    EWeekWednesday |
    EWeekThursday |
    EWeekFriday |
    EWeekSaturday |
    EWeekSunday,
}

class EWeekDaysHelper {
  static _week_days_map = new Map<string, EWeekDays>([
    ["EWeekDays::EWeekNone", EWeekDays.EWeekNone],
    ["EWeekDays::EWeekMonday", EWeekDays.EWeekMonday],
    ["EWeekDays::EWeekTuesday", EWeekDays.EWeekTuesday],
    ["EWeekDays::EWeekWednesday", EWeekDays.EWeekWednesday],
    ["EWeekDays::EWeekThursday", EWeekDays.EWeekThursday],
    ["EWeekDays::EWeekFriday", EWeekDays.EWeekFriday],
    ["EWeekDays::EWeekSaturday", EWeekDays.EWeekSaturday],
    ["EWeekDays::EWeekSunday", EWeekDays.EWeekSunday],
    ["EWeekDays::EWeekAll", EWeekDays.EWeekAll],
  ]);

  static eWeekDaysToStr(week_days: EWeekDays) {
    let ret = "EWeekDays::EWeekNone";
    EWeekDaysHelper._week_days_map.forEach((v, k, m) => {
      if (v == week_days) {
        ret = k;
      }
    });
    return ret;
  }

  static getEWeekDays(str: string) {
    try {
      return EWeekDaysHelper._week_days_map.get(str);
    } catch (e) {
      return EWeekDays.EWeekNone;
    }
  }
}

export { EWeekDays };
