import 'package:json_annotation/json_annotation.dart';


enum LedgerAccountStatusDTO {
  @JsonValue('unspecified')
  unspecified,

  @JsonValue('active')
  active,

  @JsonValue('frozen')
  frozen,
}

LedgerAccountStatusDTO ledgerAccountStatusFromJson(Object? value) {
  final raw = value?.toString() ?? '';
  var normalized = raw.trim().toLowerCase();
  const prefix = 'account_status_';
  if (normalized.startsWith(prefix)) {
    normalized = normalized.substring(prefix.length);
  }
  switch (normalized) {
    case 'active':
      return LedgerAccountStatusDTO.active;
    case 'frozen':
      return LedgerAccountStatusDTO.frozen;
    case 'unspecified':
    case '':
      return LedgerAccountStatusDTO.unspecified;
    default:
      return LedgerAccountStatusDTO.unspecified;
  }
}

String ledgerAccountStatusToJson(LedgerAccountStatusDTO value) {
  switch (value) {
    case LedgerAccountStatusDTO.active:
      return 'active';
    case LedgerAccountStatusDTO.frozen:
      return 'frozen';
    case LedgerAccountStatusDTO.unspecified:
      return 'unspecified';
  }
}
