|
|
|
|
import 'package:equatable/equatable.dart';
|
|
|
|
|
import 'package:problem_check_system/app/core/models/sync_status.dart';
|
|
|
|
|
|
|
|
|
|
/// `Enterprise` 实体,代表一个企业的核心业务对象。
|
|
|
|
|
/// 这是一个纯粹的、不可变的类,不包含任何与数据持久化相关的代码。
|
|
|
|
|
class Enterprise extends Equatable implements SyncableEntity {
|
|
|
|
|
@override
|
|
|
|
|
final String id;
|
|
|
|
|
@override
|
|
|
|
|
final SyncStatus syncStatus;
|
|
|
|
|
@override
|
|
|
|
|
final DateTime lastModifiedTime;
|
|
|
|
|
final String name;
|
|
|
|
|
final String type;
|
|
|
|
|
final String? address;
|
|
|
|
|
final String? scale;
|
|
|
|
|
final String? contactPerson;
|
|
|
|
|
final String? contactPhone;
|
|
|
|
|
final String? majorHazardsDescription;
|
|
|
|
|
final DateTime creationTime;
|
|
|
|
|
|
|
|
|
|
const Enterprise({
|
|
|
|
|
required this.id,
|
|
|
|
|
required this.name,
|
|
|
|
|
required this.type,
|
|
|
|
|
this.address,
|
|
|
|
|
this.scale,
|
|
|
|
|
this.contactPerson,
|
|
|
|
|
this.contactPhone,
|
|
|
|
|
this.majorHazardsDescription,
|
|
|
|
|
required this.lastModifiedTime,
|
|
|
|
|
required this.creationTime,
|
|
|
|
|
required this.syncStatus,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Enterprise copyWith({
|
|
|
|
|
String? id,
|
|
|
|
|
SyncStatus? syncStatus,
|
|
|
|
|
DateTime? lastModifiedTime,
|
|
|
|
|
String? name,
|
|
|
|
|
String? type,
|
|
|
|
|
String? address,
|
|
|
|
|
String? scale,
|
|
|
|
|
String? contactPerson,
|
|
|
|
|
String? contactPhone,
|
|
|
|
|
String? majorHazardsDescription,
|
|
|
|
|
DateTime? creationTime,
|
|
|
|
|
}) {
|
|
|
|
|
return Enterprise(
|
|
|
|
|
id: id ?? this.id,
|
|
|
|
|
syncStatus: syncStatus ?? this.syncStatus,
|
|
|
|
|
lastModifiedTime: lastModifiedTime ?? this.lastModifiedTime,
|
|
|
|
|
name: name ?? this.name,
|
|
|
|
|
type: type ?? this.type,
|
|
|
|
|
address: address ?? this.address,
|
|
|
|
|
scale: scale ?? this.scale,
|
|
|
|
|
contactPerson: contactPerson ?? this.contactPerson,
|
|
|
|
|
contactPhone: contactPhone ?? this.contactPhone,
|
|
|
|
|
majorHazardsDescription:
|
|
|
|
|
majorHazardsDescription ?? this.majorHazardsDescription,
|
|
|
|
|
creationTime: creationTime ?? this.creationTime,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
List<Object?> get props => [id, syncStatus, name, type];
|
|
|
|
|
}
|