Files
worker/lib/features/auth/domain/entities/customer_group.dart
2025-11-07 15:55:02 +07:00

61 lines
1.3 KiB
Dart

/// Domain Entity: Customer Group (Role)
///
/// Represents a customer group/role for user registration.
library;
/// Customer Group Entity
class CustomerGroup {
/// Unique identifier
final String name;
/// Display name
final String customerGroupName;
/// Group value/code
final String? value;
const CustomerGroup({
required this.name,
required this.customerGroupName,
this.value,
});
/// Create from JSON map
factory CustomerGroup.fromJson(Map<String, dynamic> json) {
return CustomerGroup(
name: json['name'] as String,
customerGroupName: json['customer_group_name'] as String,
value: json['value'] as String?,
);
}
/// Convert to JSON map
Map<String, dynamic> toJson() {
return {
'name': name,
'customer_group_name': customerGroupName,
if (value != null) 'value': value,
};
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is CustomerGroup &&
other.name == name &&
other.customerGroupName == customerGroupName &&
other.value == value;
}
@override
int get hashCode {
return Object.hash(name, customerGroupName, value);
}
@override
String toString() {
return 'CustomerGroup(name: $name, customerGroupName: $customerGroupName, value: $value)';
}
}