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

part of 'lib.g.dart';

final class _CollatorResolvedOptionsFfi extends ffi.Struct {
  @ffi.Int32()
  external int strength;
  @ffi.Int32()
  external int alternateHandling;
  @ffi.Int32()
  external int caseFirst;
  @ffi.Int32()
  external int maxVariable;
  @ffi.Int32()
  external int caseLevel;
  @ffi.Int32()
  external int numeric;
}

/// See the [Rust documentation for `ResolvedCollatorOptions`](https://docs.rs/icu/2.2.0/icu/collator/options/struct.ResolvedCollatorOptions.html) for more information.
final class CollatorResolvedOptions {
  // ignore: public_member_api_docs
  final CollatorStrength strength;
  // ignore: public_member_api_docs
  final CollatorAlternateHandling alternateHandling;
  // ignore: public_member_api_docs
  final CollatorCaseFirst caseFirst;
  // ignore: public_member_api_docs
  final CollatorMaxVariable maxVariable;
  // ignore: public_member_api_docs
  final CollatorCaseLevel caseLevel;
  // ignore: public_member_api_docs
  final CollatorNumericOrdering numeric;

  // This struct contains borrowed fields, so this takes in a list of
  // "edges" corresponding to where each lifetime's data may have been borrowed from
  // and passes it down to individual fields containing the borrow.
  // This method does not attempt to handle any dependencies between lifetimes, the caller
  // should handle this when constructing edge arrays.
  // ignore: unused_element
  CollatorResolvedOptions._fromFfi(_CollatorResolvedOptionsFfi ffi) :
    strength = CollatorStrength.values[ffi.strength],
    alternateHandling = CollatorAlternateHandling.values[ffi.alternateHandling],
    caseFirst = CollatorCaseFirst.values[ffi.caseFirst],
    maxVariable = CollatorMaxVariable.values[ffi.maxVariable],
    caseLevel = CollatorCaseLevel.values[ffi.caseLevel],
    numeric = CollatorNumericOrdering.values[ffi.numeric];

  // ignore: unused_element
  _CollatorResolvedOptionsFfi _toFfi(ffi.Allocator temp) {
    final struct = ffi.Struct.create<_CollatorResolvedOptionsFfi>();
    struct.strength = strength.index;
    struct.alternateHandling = alternateHandling.index;
    struct.caseFirst = caseFirst.index;
    struct.maxVariable = maxVariable.index;
    struct.caseLevel = caseLevel.index;
    struct.numeric = numeric.index;
    return struct;
  }


  @override
  bool operator ==(Object other) =>
      other is CollatorResolvedOptions &&
      other.strength == strength &&
      other.alternateHandling == alternateHandling &&
      other.caseFirst == caseFirst &&
      other.maxVariable == maxVariable &&
      other.caseLevel == caseLevel &&
      other.numeric == numeric;

  @override
  int get hashCode => Object.hashAll([
        strength,
        alternateHandling,
        caseFirst,
        maxVariable,
        caseLevel,
        numeric,
      ]);
}

// dart format on
