// generated by diplomat-tool
// dart format off

part of 'lib.g.dart';

/// The various calendar types currently supported by [Calendar]
///
/// See the [Rust documentation for `AnyCalendarKind`](https://docs.rs/icu/2.2.0/icu/calendar/enum.AnyCalendarKind.html) for more information.
enum CalendarKind {
  /// The kind of an Iso calendar
  iso,
  /// The kind of a Gregorian calendar
  gregorian,
  /// The kind of a Buddhist calendar
  buddhist,
  /// The kind of a Japanese calendar
  japanese,
  /// Deprecated, use `Japanese`
  @core.Deprecated('use `Japanese`')
  japaneseExtended,
  /// The kind of an Ethiopian calendar, with Amete Mihret era
  ethiopian,
  /// The kind of an Ethiopian calendar, with Amete Alem era
  ethiopianAmeteAlem,
  /// The kind of a Indian calendar
  indian,
  /// The kind of a Coptic calendar
  coptic,
  /// The kind of a Dangi calendar
  dangi,
  /// The kind of a Chinese calendar
  chinese,
  /// The kind of a Hebrew calendar
  hebrew,
  /// The kind of a Hijri tabular, type II leap years, Friday epoch, calendar
  hijriTabularTypeIiFriday,
  /// The kind of a Hijri simulated, Mecca calendar
  hijriSimulatedMecca,
  /// The kind of a Hijri tabular, type II leap years, Thursday epoch, calendar
  hijriTabularTypeIiThursday,
  /// The kind of a Hijri Umm al-Qura calendar
  hijriUmmAlQura,
  /// The kind of a Julian calendar,
  julian,
  /// The kind of a Persian calendar
  persian,
  /// The kind of a Roc calendar
  roc;

  int get _ffi {
    switch (this) {
      case iso:
        return 0;
      case gregorian:
        return 1;
      case buddhist:
        return 2;
      case japanese:
        return 3;
      case japaneseExtended:
        return 4;
      case ethiopian:
        return 5;
      case ethiopianAmeteAlem:
        return 6;
      case indian:
        return 7;
      case coptic:
        return 8;
      case dangi:
        return 9;
      case chinese:
        return 10;
      case hebrew:
        return 11;
      case hijriTabularTypeIiFriday:
        return 12;
      case hijriSimulatedMecca:
        return 18;
      case hijriTabularTypeIiThursday:
        return 14;
      case hijriUmmAlQura:
        return 15;
      case julian:
        return 19;
      case persian:
        return 16;
      case roc:
        return 17;
    }
  }

  /// Creates a new [CalendarKind] for the specified locale, using compiled data.
  ///
  /// See the [Rust documentation for `try_new`](https://docs.rs/icu/2.2.0/icu/calendar/enum.AnyCalendarKind.html#method.try_new) for more information.
  static CalendarKind create(Locale locale) {
    final result = _icu4x_CalendarKind_create_mv1(locale._ffi);
    return CalendarKind.values.firstWhere((v) => v._ffi == result);
  }

}

// ignore: experimental_member_use
@meta.RecordUse()
@ffi.Native<ffi.Int32 Function(ffi.Pointer<ffi.Opaque>)>(isLeaf: true, symbol: 'icu4x_CalendarKind_create_mv1')
// ignore: non_constant_identifier_names
external int _icu4x_CalendarKind_create_mv1(ffi.Pointer<ffi.Opaque> locale);

// dart format on
