/// Domain Entity: City
///
/// Represents a city/province for address selection.
library;

/// City Entity
class City {
  /// Unique city identifier
  final String name;

  /// City code (e.g., "01", "02")
  final String code;

  /// Display name
  final String cityName;

  const City({
    required this.name,
    required this.code,
    required this.cityName,
  });

  /// Create from JSON map
  factory City.fromJson(Map<String, dynamic> json) {
    return City(
      name: json['name'] as String,
      code: json['code'] as String,
      cityName: json['city_name'] as String,
    );
  }

  /// Convert to JSON map
  Map<String, dynamic> toJson() {
    return {
      'name': name,
      'code': code,
      'city_name': cityName,
    };
  }

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) return true;

    return other is City &&
        other.name == name &&
        other.code == code &&
        other.cityName == cityName;
  }

  @override
  int get hashCode {
    return Object.hash(name, code, cityName);
  }

  @override
  String toString() {
    return 'City(name: $name, code: $code, cityName: $cityName)';
  }
}
