사용하지 않는 파일 정리 전 백업 (Phase 10 완료 후 상태)
This commit is contained in:
146
lib/domain/entities/company_hierarchy.dart
Normal file
146
lib/domain/entities/company_hierarchy.dart
Normal file
@@ -0,0 +1,146 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'company_hierarchy.freezed.dart';
|
||||
|
||||
/// Company 계층 구조 도메인 엔티티
|
||||
@freezed
|
||||
class CompanyHierarchy with _$CompanyHierarchy {
|
||||
const CompanyHierarchy._();
|
||||
|
||||
const factory CompanyHierarchy({
|
||||
required String id,
|
||||
required String name,
|
||||
String? parentId,
|
||||
String? parentName,
|
||||
@Default([]) List<CompanyHierarchy> children,
|
||||
@Default(0) int level,
|
||||
@Default('') String fullPath,
|
||||
@Default(false) bool isExpanded,
|
||||
@Default(0) int totalDescendants,
|
||||
}) = _CompanyHierarchy;
|
||||
|
||||
/// 계층 구조에서 특정 회사 찾기
|
||||
CompanyHierarchy? findCompany(String companyId) {
|
||||
if (id == companyId) {
|
||||
return this;
|
||||
}
|
||||
|
||||
for (final child in children) {
|
||||
final found = child.findCompany(companyId);
|
||||
if (found != null) {
|
||||
return found;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// 모든 자손 회사 ID 목록 가져오기
|
||||
List<String> getAllDescendantIds() {
|
||||
final ids = <String>[];
|
||||
|
||||
for (final child in children) {
|
||||
ids.add(child.id);
|
||||
ids.addAll(child.getAllDescendantIds());
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// 특정 회사가 자손인지 확인
|
||||
bool hasDescendant(String companyId) {
|
||||
return getAllDescendantIds().contains(companyId);
|
||||
}
|
||||
|
||||
/// 계층 구조의 최대 깊이 계산
|
||||
int getMaxDepth() {
|
||||
if (children.isEmpty) {
|
||||
return level;
|
||||
}
|
||||
|
||||
return children
|
||||
.map((child) => child.getMaxDepth())
|
||||
.reduce((max, depth) => depth > max ? depth : max);
|
||||
}
|
||||
|
||||
/// 순환 참조 검증
|
||||
bool wouldCreateCycle(String newParentId) {
|
||||
// 자기 자신을 부모로 설정하려는 경우
|
||||
if (id == newParentId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 자손을 부모로 설정하려는 경우
|
||||
if (hasDescendant(newParentId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 계층 경로 생성
|
||||
String buildPath(String separator) {
|
||||
final parts = fullPath.split('/').where((p) => p.isNotEmpty).toList();
|
||||
return parts.join(separator);
|
||||
}
|
||||
|
||||
/// 평면 리스트로 변환 (트리 구조 → 플랫 리스트)
|
||||
List<CompanyHierarchy> flatten() {
|
||||
final flatList = <CompanyHierarchy>[this];
|
||||
|
||||
for (final child in children) {
|
||||
flatList.addAll(child.flatten());
|
||||
}
|
||||
|
||||
return flatList;
|
||||
}
|
||||
|
||||
/// 계층 구조 통계
|
||||
Map<String, dynamic> getStatistics() {
|
||||
final flat = flatten();
|
||||
return {
|
||||
'totalCompanies': flat.length,
|
||||
'maxDepth': getMaxDepth(),
|
||||
'directChildren': children.length,
|
||||
'totalDescendants': totalDescendants,
|
||||
'levels': _getLevelDistribution(flat),
|
||||
};
|
||||
}
|
||||
|
||||
Map<int, int> _getLevelDistribution(List<CompanyHierarchy> companies) {
|
||||
final distribution = <int, int>{};
|
||||
|
||||
for (final company in companies) {
|
||||
distribution[company.level] = (distribution[company.level] ?? 0) + 1;
|
||||
}
|
||||
|
||||
return distribution;
|
||||
}
|
||||
}
|
||||
|
||||
/// 계층 구조 검증 결과
|
||||
@freezed
|
||||
class HierarchyValidationResult with _$HierarchyValidationResult {
|
||||
const factory HierarchyValidationResult({
|
||||
required bool isValid,
|
||||
@Default('') String message,
|
||||
@Default([]) List<String> errors,
|
||||
@Default([]) List<String> warnings,
|
||||
}) = _HierarchyValidationResult;
|
||||
|
||||
factory HierarchyValidationResult.valid() => const HierarchyValidationResult(
|
||||
isValid: true,
|
||||
message: 'Hierarchy is valid',
|
||||
);
|
||||
|
||||
factory HierarchyValidationResult.invalid({
|
||||
required String message,
|
||||
List<String> errors = const [],
|
||||
List<String> warnings = const [],
|
||||
}) => HierarchyValidationResult(
|
||||
isValid: false,
|
||||
message: message,
|
||||
errors: errors,
|
||||
warnings: warnings,
|
||||
);
|
||||
}
|
||||
555
lib/domain/entities/company_hierarchy.freezed.dart
Normal file
555
lib/domain/entities/company_hierarchy.freezed.dart
Normal file
@@ -0,0 +1,555 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'company_hierarchy.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CompanyHierarchy {
|
||||
String get id => throw _privateConstructorUsedError;
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
String? get parentId => throw _privateConstructorUsedError;
|
||||
String? get parentName => throw _privateConstructorUsedError;
|
||||
List<CompanyHierarchy> get children => throw _privateConstructorUsedError;
|
||||
int get level => throw _privateConstructorUsedError;
|
||||
String get fullPath => throw _privateConstructorUsedError;
|
||||
bool get isExpanded => throw _privateConstructorUsedError;
|
||||
int get totalDescendants => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of CompanyHierarchy
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$CompanyHierarchyCopyWith<CompanyHierarchy> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $CompanyHierarchyCopyWith<$Res> {
|
||||
factory $CompanyHierarchyCopyWith(
|
||||
CompanyHierarchy value, $Res Function(CompanyHierarchy) then) =
|
||||
_$CompanyHierarchyCopyWithImpl<$Res, CompanyHierarchy>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
String name,
|
||||
String? parentId,
|
||||
String? parentName,
|
||||
List<CompanyHierarchy> children,
|
||||
int level,
|
||||
String fullPath,
|
||||
bool isExpanded,
|
||||
int totalDescendants});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$CompanyHierarchyCopyWithImpl<$Res, $Val extends CompanyHierarchy>
|
||||
implements $CompanyHierarchyCopyWith<$Res> {
|
||||
_$CompanyHierarchyCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of CompanyHierarchy
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? name = null,
|
||||
Object? parentId = freezed,
|
||||
Object? parentName = freezed,
|
||||
Object? children = null,
|
||||
Object? level = null,
|
||||
Object? fullPath = null,
|
||||
Object? isExpanded = null,
|
||||
Object? totalDescendants = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
parentId: freezed == parentId
|
||||
? _value.parentId
|
||||
: parentId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
parentName: freezed == parentName
|
||||
? _value.parentName
|
||||
: parentName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
children: null == children
|
||||
? _value.children
|
||||
: children // ignore: cast_nullable_to_non_nullable
|
||||
as List<CompanyHierarchy>,
|
||||
level: null == level
|
||||
? _value.level
|
||||
: level // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
fullPath: null == fullPath
|
||||
? _value.fullPath
|
||||
: fullPath // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
isExpanded: null == isExpanded
|
||||
? _value.isExpanded
|
||||
: isExpanded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
totalDescendants: null == totalDescendants
|
||||
? _value.totalDescendants
|
||||
: totalDescendants // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$CompanyHierarchyImplCopyWith<$Res>
|
||||
implements $CompanyHierarchyCopyWith<$Res> {
|
||||
factory _$$CompanyHierarchyImplCopyWith(_$CompanyHierarchyImpl value,
|
||||
$Res Function(_$CompanyHierarchyImpl) then) =
|
||||
__$$CompanyHierarchyImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{String id,
|
||||
String name,
|
||||
String? parentId,
|
||||
String? parentName,
|
||||
List<CompanyHierarchy> children,
|
||||
int level,
|
||||
String fullPath,
|
||||
bool isExpanded,
|
||||
int totalDescendants});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$CompanyHierarchyImplCopyWithImpl<$Res>
|
||||
extends _$CompanyHierarchyCopyWithImpl<$Res, _$CompanyHierarchyImpl>
|
||||
implements _$$CompanyHierarchyImplCopyWith<$Res> {
|
||||
__$$CompanyHierarchyImplCopyWithImpl(_$CompanyHierarchyImpl _value,
|
||||
$Res Function(_$CompanyHierarchyImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of CompanyHierarchy
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? id = null,
|
||||
Object? name = null,
|
||||
Object? parentId = freezed,
|
||||
Object? parentName = freezed,
|
||||
Object? children = null,
|
||||
Object? level = null,
|
||||
Object? fullPath = null,
|
||||
Object? isExpanded = null,
|
||||
Object? totalDescendants = null,
|
||||
}) {
|
||||
return _then(_$CompanyHierarchyImpl(
|
||||
id: null == id
|
||||
? _value.id
|
||||
: id // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
parentId: freezed == parentId
|
||||
? _value.parentId
|
||||
: parentId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
parentName: freezed == parentName
|
||||
? _value.parentName
|
||||
: parentName // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
children: null == children
|
||||
? _value._children
|
||||
: children // ignore: cast_nullable_to_non_nullable
|
||||
as List<CompanyHierarchy>,
|
||||
level: null == level
|
||||
? _value.level
|
||||
: level // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
fullPath: null == fullPath
|
||||
? _value.fullPath
|
||||
: fullPath // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
isExpanded: null == isExpanded
|
||||
? _value.isExpanded
|
||||
: isExpanded // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
totalDescendants: null == totalDescendants
|
||||
? _value.totalDescendants
|
||||
: totalDescendants // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$CompanyHierarchyImpl extends _CompanyHierarchy {
|
||||
const _$CompanyHierarchyImpl(
|
||||
{required this.id,
|
||||
required this.name,
|
||||
this.parentId,
|
||||
this.parentName,
|
||||
final List<CompanyHierarchy> children = const [],
|
||||
this.level = 0,
|
||||
this.fullPath = '',
|
||||
this.isExpanded = false,
|
||||
this.totalDescendants = 0})
|
||||
: _children = children,
|
||||
super._();
|
||||
|
||||
@override
|
||||
final String id;
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final String? parentId;
|
||||
@override
|
||||
final String? parentName;
|
||||
final List<CompanyHierarchy> _children;
|
||||
@override
|
||||
@JsonKey()
|
||||
List<CompanyHierarchy> get children {
|
||||
if (_children is EqualUnmodifiableListView) return _children;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_children);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final int level;
|
||||
@override
|
||||
@JsonKey()
|
||||
final String fullPath;
|
||||
@override
|
||||
@JsonKey()
|
||||
final bool isExpanded;
|
||||
@override
|
||||
@JsonKey()
|
||||
final int totalDescendants;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CompanyHierarchy(id: $id, name: $name, parentId: $parentId, parentName: $parentName, children: $children, level: $level, fullPath: $fullPath, isExpanded: $isExpanded, totalDescendants: $totalDescendants)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$CompanyHierarchyImpl &&
|
||||
(identical(other.id, id) || other.id == id) &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.parentId, parentId) ||
|
||||
other.parentId == parentId) &&
|
||||
(identical(other.parentName, parentName) ||
|
||||
other.parentName == parentName) &&
|
||||
const DeepCollectionEquality().equals(other._children, _children) &&
|
||||
(identical(other.level, level) || other.level == level) &&
|
||||
(identical(other.fullPath, fullPath) ||
|
||||
other.fullPath == fullPath) &&
|
||||
(identical(other.isExpanded, isExpanded) ||
|
||||
other.isExpanded == isExpanded) &&
|
||||
(identical(other.totalDescendants, totalDescendants) ||
|
||||
other.totalDescendants == totalDescendants));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
id,
|
||||
name,
|
||||
parentId,
|
||||
parentName,
|
||||
const DeepCollectionEquality().hash(_children),
|
||||
level,
|
||||
fullPath,
|
||||
isExpanded,
|
||||
totalDescendants);
|
||||
|
||||
/// Create a copy of CompanyHierarchy
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$CompanyHierarchyImplCopyWith<_$CompanyHierarchyImpl> get copyWith =>
|
||||
__$$CompanyHierarchyImplCopyWithImpl<_$CompanyHierarchyImpl>(
|
||||
this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _CompanyHierarchy extends CompanyHierarchy {
|
||||
const factory _CompanyHierarchy(
|
||||
{required final String id,
|
||||
required final String name,
|
||||
final String? parentId,
|
||||
final String? parentName,
|
||||
final List<CompanyHierarchy> children,
|
||||
final int level,
|
||||
final String fullPath,
|
||||
final bool isExpanded,
|
||||
final int totalDescendants}) = _$CompanyHierarchyImpl;
|
||||
const _CompanyHierarchy._() : super._();
|
||||
|
||||
@override
|
||||
String get id;
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
String? get parentId;
|
||||
@override
|
||||
String? get parentName;
|
||||
@override
|
||||
List<CompanyHierarchy> get children;
|
||||
@override
|
||||
int get level;
|
||||
@override
|
||||
String get fullPath;
|
||||
@override
|
||||
bool get isExpanded;
|
||||
@override
|
||||
int get totalDescendants;
|
||||
|
||||
/// Create a copy of CompanyHierarchy
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$CompanyHierarchyImplCopyWith<_$CompanyHierarchyImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$HierarchyValidationResult {
|
||||
bool get isValid => throw _privateConstructorUsedError;
|
||||
String get message => throw _privateConstructorUsedError;
|
||||
List<String> get errors => throw _privateConstructorUsedError;
|
||||
List<String> get warnings => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of HierarchyValidationResult
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$HierarchyValidationResultCopyWith<HierarchyValidationResult> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $HierarchyValidationResultCopyWith<$Res> {
|
||||
factory $HierarchyValidationResultCopyWith(HierarchyValidationResult value,
|
||||
$Res Function(HierarchyValidationResult) then) =
|
||||
_$HierarchyValidationResultCopyWithImpl<$Res, HierarchyValidationResult>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{bool isValid,
|
||||
String message,
|
||||
List<String> errors,
|
||||
List<String> warnings});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$HierarchyValidationResultCopyWithImpl<$Res,
|
||||
$Val extends HierarchyValidationResult>
|
||||
implements $HierarchyValidationResultCopyWith<$Res> {
|
||||
_$HierarchyValidationResultCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of HierarchyValidationResult
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? isValid = null,
|
||||
Object? message = null,
|
||||
Object? errors = null,
|
||||
Object? warnings = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
isValid: null == isValid
|
||||
? _value.isValid
|
||||
: isValid // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
message: null == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
errors: null == errors
|
||||
? _value.errors
|
||||
: errors // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
warnings: null == warnings
|
||||
? _value.warnings
|
||||
: warnings // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$HierarchyValidationResultImplCopyWith<$Res>
|
||||
implements $HierarchyValidationResultCopyWith<$Res> {
|
||||
factory _$$HierarchyValidationResultImplCopyWith(
|
||||
_$HierarchyValidationResultImpl value,
|
||||
$Res Function(_$HierarchyValidationResultImpl) then) =
|
||||
__$$HierarchyValidationResultImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{bool isValid,
|
||||
String message,
|
||||
List<String> errors,
|
||||
List<String> warnings});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$HierarchyValidationResultImplCopyWithImpl<$Res>
|
||||
extends _$HierarchyValidationResultCopyWithImpl<$Res,
|
||||
_$HierarchyValidationResultImpl>
|
||||
implements _$$HierarchyValidationResultImplCopyWith<$Res> {
|
||||
__$$HierarchyValidationResultImplCopyWithImpl(
|
||||
_$HierarchyValidationResultImpl _value,
|
||||
$Res Function(_$HierarchyValidationResultImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of HierarchyValidationResult
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? isValid = null,
|
||||
Object? message = null,
|
||||
Object? errors = null,
|
||||
Object? warnings = null,
|
||||
}) {
|
||||
return _then(_$HierarchyValidationResultImpl(
|
||||
isValid: null == isValid
|
||||
? _value.isValid
|
||||
: isValid // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
message: null == message
|
||||
? _value.message
|
||||
: message // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
errors: null == errors
|
||||
? _value._errors
|
||||
: errors // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
warnings: null == warnings
|
||||
? _value._warnings
|
||||
: warnings // ignore: cast_nullable_to_non_nullable
|
||||
as List<String>,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$HierarchyValidationResultImpl implements _HierarchyValidationResult {
|
||||
const _$HierarchyValidationResultImpl(
|
||||
{required this.isValid,
|
||||
this.message = '',
|
||||
final List<String> errors = const [],
|
||||
final List<String> warnings = const []})
|
||||
: _errors = errors,
|
||||
_warnings = warnings;
|
||||
|
||||
@override
|
||||
final bool isValid;
|
||||
@override
|
||||
@JsonKey()
|
||||
final String message;
|
||||
final List<String> _errors;
|
||||
@override
|
||||
@JsonKey()
|
||||
List<String> get errors {
|
||||
if (_errors is EqualUnmodifiableListView) return _errors;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_errors);
|
||||
}
|
||||
|
||||
final List<String> _warnings;
|
||||
@override
|
||||
@JsonKey()
|
||||
List<String> get warnings {
|
||||
if (_warnings is EqualUnmodifiableListView) return _warnings;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_warnings);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HierarchyValidationResult(isValid: $isValid, message: $message, errors: $errors, warnings: $warnings)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$HierarchyValidationResultImpl &&
|
||||
(identical(other.isValid, isValid) || other.isValid == isValid) &&
|
||||
(identical(other.message, message) || other.message == message) &&
|
||||
const DeepCollectionEquality().equals(other._errors, _errors) &&
|
||||
const DeepCollectionEquality().equals(other._warnings, _warnings));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
isValid,
|
||||
message,
|
||||
const DeepCollectionEquality().hash(_errors),
|
||||
const DeepCollectionEquality().hash(_warnings));
|
||||
|
||||
/// Create a copy of HierarchyValidationResult
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$HierarchyValidationResultImplCopyWith<_$HierarchyValidationResultImpl>
|
||||
get copyWith => __$$HierarchyValidationResultImplCopyWithImpl<
|
||||
_$HierarchyValidationResultImpl>(this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _HierarchyValidationResult implements HierarchyValidationResult {
|
||||
const factory _HierarchyValidationResult(
|
||||
{required final bool isValid,
|
||||
final String message,
|
||||
final List<String> errors,
|
||||
final List<String> warnings}) = _$HierarchyValidationResultImpl;
|
||||
|
||||
@override
|
||||
bool get isValid;
|
||||
@override
|
||||
String get message;
|
||||
@override
|
||||
List<String> get errors;
|
||||
@override
|
||||
List<String> get warnings;
|
||||
|
||||
/// Create a copy of HierarchyValidationResult
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$HierarchyValidationResultImplCopyWith<_$HierarchyValidationResultImpl>
|
||||
get copyWith => throw _privateConstructorUsedError;
|
||||
}
|
||||
138
lib/domain/entities/maintenance_schedule.dart
Normal file
138
lib/domain/entities/maintenance_schedule.dart
Normal file
@@ -0,0 +1,138 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'maintenance_schedule.freezed.dart';
|
||||
|
||||
@freezed
|
||||
class MaintenanceSchedule with _$MaintenanceSchedule {
|
||||
const MaintenanceSchedule._();
|
||||
|
||||
const factory MaintenanceSchedule({
|
||||
required int equipmentHistoryId,
|
||||
required String maintenanceType,
|
||||
required int periodMonths,
|
||||
required DateTime startDate,
|
||||
required DateTime endDate,
|
||||
DateTime? lastMaintenanceDate,
|
||||
DateTime? nextMaintenanceDate,
|
||||
required double cost,
|
||||
String? description,
|
||||
@Default([]) List<DateTime> scheduledDates,
|
||||
@Default(MaintenanceScheduleStatus.active) MaintenanceScheduleStatus status,
|
||||
}) = _MaintenanceSchedule;
|
||||
|
||||
// 다음 유지보수 날짜 계산
|
||||
DateTime calculateNextMaintenanceDate() {
|
||||
final lastDate = lastMaintenanceDate ?? startDate;
|
||||
return lastDate.add(Duration(days: periodMonths * 30));
|
||||
}
|
||||
|
||||
// 남은 일수 계산
|
||||
int getDaysUntilNextMaintenance() {
|
||||
final next = nextMaintenanceDate ?? calculateNextMaintenanceDate();
|
||||
return next.difference(DateTime.now()).inDays;
|
||||
}
|
||||
|
||||
// 만료 여부 확인
|
||||
bool isOverdue() {
|
||||
final daysUntil = getDaysUntilNextMaintenance();
|
||||
return daysUntil < 0;
|
||||
}
|
||||
|
||||
// 곧 만료 예정 여부 확인 (30일 이내)
|
||||
bool isUpcoming({int daysThreshold = 30}) {
|
||||
final daysUntil = getDaysUntilNextMaintenance();
|
||||
return daysUntil >= 0 && daysUntil <= daysThreshold;
|
||||
}
|
||||
|
||||
// 전체 스케줄 생성
|
||||
List<DateTime> generateFullSchedule() {
|
||||
final schedules = <DateTime>[];
|
||||
var currentDate = startDate;
|
||||
|
||||
while (currentDate.isBefore(endDate)) {
|
||||
schedules.add(currentDate);
|
||||
currentDate = currentDate.add(Duration(days: periodMonths * 30));
|
||||
}
|
||||
|
||||
return schedules;
|
||||
}
|
||||
|
||||
// 남은 유지보수 횟수 계산
|
||||
int getRemainingMaintenanceCount() {
|
||||
final now = DateTime.now();
|
||||
final schedules = generateFullSchedule();
|
||||
return schedules.where((date) => date.isAfter(now)).length;
|
||||
}
|
||||
|
||||
// 총 비용 계산
|
||||
double getTotalCost() {
|
||||
final totalCount = generateFullSchedule().length;
|
||||
return cost * totalCount;
|
||||
}
|
||||
|
||||
// 남은 비용 계산
|
||||
double getRemainingCost() {
|
||||
return cost * getRemainingMaintenanceCount();
|
||||
}
|
||||
}
|
||||
|
||||
enum MaintenanceScheduleStatus {
|
||||
active, // 활성
|
||||
paused, // 일시중지
|
||||
completed,// 완료
|
||||
cancelled // 취소
|
||||
}
|
||||
|
||||
// 유지보수 알림 설정
|
||||
@freezed
|
||||
class MaintenanceAlert with _$MaintenanceAlert {
|
||||
const MaintenanceAlert._();
|
||||
|
||||
const factory MaintenanceAlert({
|
||||
required int maintenanceId,
|
||||
required int equipmentHistoryId,
|
||||
required String equipmentName,
|
||||
required DateTime scheduledDate,
|
||||
required String maintenanceType,
|
||||
required int daysUntil,
|
||||
required AlertPriority priority,
|
||||
String? description,
|
||||
double? estimatedCost,
|
||||
}) = _MaintenanceAlert;
|
||||
|
||||
// Backward compatibility getter
|
||||
int get daysUntilDue => daysUntil;
|
||||
|
||||
factory MaintenanceAlert.fromSchedule(
|
||||
MaintenanceSchedule schedule,
|
||||
String equipmentName,
|
||||
) {
|
||||
final daysUntil = schedule.getDaysUntilNextMaintenance();
|
||||
final priority = _getPriority(daysUntil);
|
||||
|
||||
return MaintenanceAlert(
|
||||
maintenanceId: 0, // Will be set from actual maintenance
|
||||
equipmentHistoryId: schedule.equipmentHistoryId,
|
||||
equipmentName: equipmentName,
|
||||
scheduledDate: schedule.nextMaintenanceDate ?? schedule.calculateNextMaintenanceDate(),
|
||||
maintenanceType: schedule.maintenanceType,
|
||||
daysUntil: daysUntil,
|
||||
priority: priority,
|
||||
description: schedule.description,
|
||||
);
|
||||
}
|
||||
|
||||
static AlertPriority _getPriority(int daysUntil) {
|
||||
if (daysUntil < 0) return AlertPriority.critical;
|
||||
if (daysUntil <= 7) return AlertPriority.high;
|
||||
if (daysUntil <= 30) return AlertPriority.medium;
|
||||
return AlertPriority.low;
|
||||
}
|
||||
}
|
||||
|
||||
enum AlertPriority {
|
||||
critical, // 만료됨
|
||||
high, // 7일 이내
|
||||
medium, // 30일 이내
|
||||
low // 30일 초과
|
||||
}
|
||||
693
lib/domain/entities/maintenance_schedule.freezed.dart
Normal file
693
lib/domain/entities/maintenance_schedule.freezed.dart
Normal file
@@ -0,0 +1,693 @@
|
||||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'maintenance_schedule.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||
|
||||
/// @nodoc
|
||||
mixin _$MaintenanceSchedule {
|
||||
int get equipmentHistoryId => throw _privateConstructorUsedError;
|
||||
String get maintenanceType => throw _privateConstructorUsedError;
|
||||
int get periodMonths => throw _privateConstructorUsedError;
|
||||
DateTime get startDate => throw _privateConstructorUsedError;
|
||||
DateTime get endDate => throw _privateConstructorUsedError;
|
||||
DateTime? get lastMaintenanceDate => throw _privateConstructorUsedError;
|
||||
DateTime? get nextMaintenanceDate => throw _privateConstructorUsedError;
|
||||
double get cost => throw _privateConstructorUsedError;
|
||||
String? get description => throw _privateConstructorUsedError;
|
||||
List<DateTime> get scheduledDates => throw _privateConstructorUsedError;
|
||||
MaintenanceScheduleStatus get status => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of MaintenanceSchedule
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$MaintenanceScheduleCopyWith<MaintenanceSchedule> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $MaintenanceScheduleCopyWith<$Res> {
|
||||
factory $MaintenanceScheduleCopyWith(
|
||||
MaintenanceSchedule value, $Res Function(MaintenanceSchedule) then) =
|
||||
_$MaintenanceScheduleCopyWithImpl<$Res, MaintenanceSchedule>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int equipmentHistoryId,
|
||||
String maintenanceType,
|
||||
int periodMonths,
|
||||
DateTime startDate,
|
||||
DateTime endDate,
|
||||
DateTime? lastMaintenanceDate,
|
||||
DateTime? nextMaintenanceDate,
|
||||
double cost,
|
||||
String? description,
|
||||
List<DateTime> scheduledDates,
|
||||
MaintenanceScheduleStatus status});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$MaintenanceScheduleCopyWithImpl<$Res, $Val extends MaintenanceSchedule>
|
||||
implements $MaintenanceScheduleCopyWith<$Res> {
|
||||
_$MaintenanceScheduleCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of MaintenanceSchedule
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentHistoryId = null,
|
||||
Object? maintenanceType = null,
|
||||
Object? periodMonths = null,
|
||||
Object? startDate = null,
|
||||
Object? endDate = null,
|
||||
Object? lastMaintenanceDate = freezed,
|
||||
Object? nextMaintenanceDate = freezed,
|
||||
Object? cost = null,
|
||||
Object? description = freezed,
|
||||
Object? scheduledDates = null,
|
||||
Object? status = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
equipmentHistoryId: null == equipmentHistoryId
|
||||
? _value.equipmentHistoryId
|
||||
: equipmentHistoryId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
maintenanceType: null == maintenanceType
|
||||
? _value.maintenanceType
|
||||
: maintenanceType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
periodMonths: null == periodMonths
|
||||
? _value.periodMonths
|
||||
: periodMonths // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
startDate: null == startDate
|
||||
? _value.startDate
|
||||
: startDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
endDate: null == endDate
|
||||
? _value.endDate
|
||||
: endDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
lastMaintenanceDate: freezed == lastMaintenanceDate
|
||||
? _value.lastMaintenanceDate
|
||||
: lastMaintenanceDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
nextMaintenanceDate: freezed == nextMaintenanceDate
|
||||
? _value.nextMaintenanceDate
|
||||
: nextMaintenanceDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
cost: null == cost
|
||||
? _value.cost
|
||||
: cost // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
description: freezed == description
|
||||
? _value.description
|
||||
: description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
scheduledDates: null == scheduledDates
|
||||
? _value.scheduledDates
|
||||
: scheduledDates // ignore: cast_nullable_to_non_nullable
|
||||
as List<DateTime>,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as MaintenanceScheduleStatus,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MaintenanceScheduleImplCopyWith<$Res>
|
||||
implements $MaintenanceScheduleCopyWith<$Res> {
|
||||
factory _$$MaintenanceScheduleImplCopyWith(_$MaintenanceScheduleImpl value,
|
||||
$Res Function(_$MaintenanceScheduleImpl) then) =
|
||||
__$$MaintenanceScheduleImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int equipmentHistoryId,
|
||||
String maintenanceType,
|
||||
int periodMonths,
|
||||
DateTime startDate,
|
||||
DateTime endDate,
|
||||
DateTime? lastMaintenanceDate,
|
||||
DateTime? nextMaintenanceDate,
|
||||
double cost,
|
||||
String? description,
|
||||
List<DateTime> scheduledDates,
|
||||
MaintenanceScheduleStatus status});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MaintenanceScheduleImplCopyWithImpl<$Res>
|
||||
extends _$MaintenanceScheduleCopyWithImpl<$Res, _$MaintenanceScheduleImpl>
|
||||
implements _$$MaintenanceScheduleImplCopyWith<$Res> {
|
||||
__$$MaintenanceScheduleImplCopyWithImpl(_$MaintenanceScheduleImpl _value,
|
||||
$Res Function(_$MaintenanceScheduleImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of MaintenanceSchedule
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? equipmentHistoryId = null,
|
||||
Object? maintenanceType = null,
|
||||
Object? periodMonths = null,
|
||||
Object? startDate = null,
|
||||
Object? endDate = null,
|
||||
Object? lastMaintenanceDate = freezed,
|
||||
Object? nextMaintenanceDate = freezed,
|
||||
Object? cost = null,
|
||||
Object? description = freezed,
|
||||
Object? scheduledDates = null,
|
||||
Object? status = null,
|
||||
}) {
|
||||
return _then(_$MaintenanceScheduleImpl(
|
||||
equipmentHistoryId: null == equipmentHistoryId
|
||||
? _value.equipmentHistoryId
|
||||
: equipmentHistoryId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
maintenanceType: null == maintenanceType
|
||||
? _value.maintenanceType
|
||||
: maintenanceType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
periodMonths: null == periodMonths
|
||||
? _value.periodMonths
|
||||
: periodMonths // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
startDate: null == startDate
|
||||
? _value.startDate
|
||||
: startDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
endDate: null == endDate
|
||||
? _value.endDate
|
||||
: endDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
lastMaintenanceDate: freezed == lastMaintenanceDate
|
||||
? _value.lastMaintenanceDate
|
||||
: lastMaintenanceDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
nextMaintenanceDate: freezed == nextMaintenanceDate
|
||||
? _value.nextMaintenanceDate
|
||||
: nextMaintenanceDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime?,
|
||||
cost: null == cost
|
||||
? _value.cost
|
||||
: cost // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
description: freezed == description
|
||||
? _value.description
|
||||
: description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
scheduledDates: null == scheduledDates
|
||||
? _value._scheduledDates
|
||||
: scheduledDates // ignore: cast_nullable_to_non_nullable
|
||||
as List<DateTime>,
|
||||
status: null == status
|
||||
? _value.status
|
||||
: status // ignore: cast_nullable_to_non_nullable
|
||||
as MaintenanceScheduleStatus,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$MaintenanceScheduleImpl extends _MaintenanceSchedule {
|
||||
const _$MaintenanceScheduleImpl(
|
||||
{required this.equipmentHistoryId,
|
||||
required this.maintenanceType,
|
||||
required this.periodMonths,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
this.lastMaintenanceDate,
|
||||
this.nextMaintenanceDate,
|
||||
required this.cost,
|
||||
this.description,
|
||||
final List<DateTime> scheduledDates = const [],
|
||||
this.status = MaintenanceScheduleStatus.active})
|
||||
: _scheduledDates = scheduledDates,
|
||||
super._();
|
||||
|
||||
@override
|
||||
final int equipmentHistoryId;
|
||||
@override
|
||||
final String maintenanceType;
|
||||
@override
|
||||
final int periodMonths;
|
||||
@override
|
||||
final DateTime startDate;
|
||||
@override
|
||||
final DateTime endDate;
|
||||
@override
|
||||
final DateTime? lastMaintenanceDate;
|
||||
@override
|
||||
final DateTime? nextMaintenanceDate;
|
||||
@override
|
||||
final double cost;
|
||||
@override
|
||||
final String? description;
|
||||
final List<DateTime> _scheduledDates;
|
||||
@override
|
||||
@JsonKey()
|
||||
List<DateTime> get scheduledDates {
|
||||
if (_scheduledDates is EqualUnmodifiableListView) return _scheduledDates;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_scheduledDates);
|
||||
}
|
||||
|
||||
@override
|
||||
@JsonKey()
|
||||
final MaintenanceScheduleStatus status;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MaintenanceSchedule(equipmentHistoryId: $equipmentHistoryId, maintenanceType: $maintenanceType, periodMonths: $periodMonths, startDate: $startDate, endDate: $endDate, lastMaintenanceDate: $lastMaintenanceDate, nextMaintenanceDate: $nextMaintenanceDate, cost: $cost, description: $description, scheduledDates: $scheduledDates, status: $status)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MaintenanceScheduleImpl &&
|
||||
(identical(other.equipmentHistoryId, equipmentHistoryId) ||
|
||||
other.equipmentHistoryId == equipmentHistoryId) &&
|
||||
(identical(other.maintenanceType, maintenanceType) ||
|
||||
other.maintenanceType == maintenanceType) &&
|
||||
(identical(other.periodMonths, periodMonths) ||
|
||||
other.periodMonths == periodMonths) &&
|
||||
(identical(other.startDate, startDate) ||
|
||||
other.startDate == startDate) &&
|
||||
(identical(other.endDate, endDate) || other.endDate == endDate) &&
|
||||
(identical(other.lastMaintenanceDate, lastMaintenanceDate) ||
|
||||
other.lastMaintenanceDate == lastMaintenanceDate) &&
|
||||
(identical(other.nextMaintenanceDate, nextMaintenanceDate) ||
|
||||
other.nextMaintenanceDate == nextMaintenanceDate) &&
|
||||
(identical(other.cost, cost) || other.cost == cost) &&
|
||||
(identical(other.description, description) ||
|
||||
other.description == description) &&
|
||||
const DeepCollectionEquality()
|
||||
.equals(other._scheduledDates, _scheduledDates) &&
|
||||
(identical(other.status, status) || other.status == status));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
equipmentHistoryId,
|
||||
maintenanceType,
|
||||
periodMonths,
|
||||
startDate,
|
||||
endDate,
|
||||
lastMaintenanceDate,
|
||||
nextMaintenanceDate,
|
||||
cost,
|
||||
description,
|
||||
const DeepCollectionEquality().hash(_scheduledDates),
|
||||
status);
|
||||
|
||||
/// Create a copy of MaintenanceSchedule
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$MaintenanceScheduleImplCopyWith<_$MaintenanceScheduleImpl> get copyWith =>
|
||||
__$$MaintenanceScheduleImplCopyWithImpl<_$MaintenanceScheduleImpl>(
|
||||
this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _MaintenanceSchedule extends MaintenanceSchedule {
|
||||
const factory _MaintenanceSchedule(
|
||||
{required final int equipmentHistoryId,
|
||||
required final String maintenanceType,
|
||||
required final int periodMonths,
|
||||
required final DateTime startDate,
|
||||
required final DateTime endDate,
|
||||
final DateTime? lastMaintenanceDate,
|
||||
final DateTime? nextMaintenanceDate,
|
||||
required final double cost,
|
||||
final String? description,
|
||||
final List<DateTime> scheduledDates,
|
||||
final MaintenanceScheduleStatus status}) = _$MaintenanceScheduleImpl;
|
||||
const _MaintenanceSchedule._() : super._();
|
||||
|
||||
@override
|
||||
int get equipmentHistoryId;
|
||||
@override
|
||||
String get maintenanceType;
|
||||
@override
|
||||
int get periodMonths;
|
||||
@override
|
||||
DateTime get startDate;
|
||||
@override
|
||||
DateTime get endDate;
|
||||
@override
|
||||
DateTime? get lastMaintenanceDate;
|
||||
@override
|
||||
DateTime? get nextMaintenanceDate;
|
||||
@override
|
||||
double get cost;
|
||||
@override
|
||||
String? get description;
|
||||
@override
|
||||
List<DateTime> get scheduledDates;
|
||||
@override
|
||||
MaintenanceScheduleStatus get status;
|
||||
|
||||
/// Create a copy of MaintenanceSchedule
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$MaintenanceScheduleImplCopyWith<_$MaintenanceScheduleImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$MaintenanceAlert {
|
||||
int get maintenanceId => throw _privateConstructorUsedError;
|
||||
int get equipmentHistoryId => throw _privateConstructorUsedError;
|
||||
String get equipmentName => throw _privateConstructorUsedError;
|
||||
DateTime get scheduledDate => throw _privateConstructorUsedError;
|
||||
String get maintenanceType => throw _privateConstructorUsedError;
|
||||
int get daysUntil => throw _privateConstructorUsedError;
|
||||
AlertPriority get priority => throw _privateConstructorUsedError;
|
||||
String? get description => throw _privateConstructorUsedError;
|
||||
double? get estimatedCost => throw _privateConstructorUsedError;
|
||||
|
||||
/// Create a copy of MaintenanceAlert
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
$MaintenanceAlertCopyWith<MaintenanceAlert> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $MaintenanceAlertCopyWith<$Res> {
|
||||
factory $MaintenanceAlertCopyWith(
|
||||
MaintenanceAlert value, $Res Function(MaintenanceAlert) then) =
|
||||
_$MaintenanceAlertCopyWithImpl<$Res, MaintenanceAlert>;
|
||||
@useResult
|
||||
$Res call(
|
||||
{int maintenanceId,
|
||||
int equipmentHistoryId,
|
||||
String equipmentName,
|
||||
DateTime scheduledDate,
|
||||
String maintenanceType,
|
||||
int daysUntil,
|
||||
AlertPriority priority,
|
||||
String? description,
|
||||
double? estimatedCost});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$MaintenanceAlertCopyWithImpl<$Res, $Val extends MaintenanceAlert>
|
||||
implements $MaintenanceAlertCopyWith<$Res> {
|
||||
_$MaintenanceAlertCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
/// Create a copy of MaintenanceAlert
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? maintenanceId = null,
|
||||
Object? equipmentHistoryId = null,
|
||||
Object? equipmentName = null,
|
||||
Object? scheduledDate = null,
|
||||
Object? maintenanceType = null,
|
||||
Object? daysUntil = null,
|
||||
Object? priority = null,
|
||||
Object? description = freezed,
|
||||
Object? estimatedCost = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
maintenanceId: null == maintenanceId
|
||||
? _value.maintenanceId
|
||||
: maintenanceId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentHistoryId: null == equipmentHistoryId
|
||||
? _value.equipmentHistoryId
|
||||
: equipmentHistoryId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentName: null == equipmentName
|
||||
? _value.equipmentName
|
||||
: equipmentName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
scheduledDate: null == scheduledDate
|
||||
? _value.scheduledDate
|
||||
: scheduledDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
maintenanceType: null == maintenanceType
|
||||
? _value.maintenanceType
|
||||
: maintenanceType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
daysUntil: null == daysUntil
|
||||
? _value.daysUntil
|
||||
: daysUntil // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
priority: null == priority
|
||||
? _value.priority
|
||||
: priority // ignore: cast_nullable_to_non_nullable
|
||||
as AlertPriority,
|
||||
description: freezed == description
|
||||
? _value.description
|
||||
: description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
estimatedCost: freezed == estimatedCost
|
||||
? _value.estimatedCost
|
||||
: estimatedCost // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$MaintenanceAlertImplCopyWith<$Res>
|
||||
implements $MaintenanceAlertCopyWith<$Res> {
|
||||
factory _$$MaintenanceAlertImplCopyWith(_$MaintenanceAlertImpl value,
|
||||
$Res Function(_$MaintenanceAlertImpl) then) =
|
||||
__$$MaintenanceAlertImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call(
|
||||
{int maintenanceId,
|
||||
int equipmentHistoryId,
|
||||
String equipmentName,
|
||||
DateTime scheduledDate,
|
||||
String maintenanceType,
|
||||
int daysUntil,
|
||||
AlertPriority priority,
|
||||
String? description,
|
||||
double? estimatedCost});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$MaintenanceAlertImplCopyWithImpl<$Res>
|
||||
extends _$MaintenanceAlertCopyWithImpl<$Res, _$MaintenanceAlertImpl>
|
||||
implements _$$MaintenanceAlertImplCopyWith<$Res> {
|
||||
__$$MaintenanceAlertImplCopyWithImpl(_$MaintenanceAlertImpl _value,
|
||||
$Res Function(_$MaintenanceAlertImpl) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
/// Create a copy of MaintenanceAlert
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? maintenanceId = null,
|
||||
Object? equipmentHistoryId = null,
|
||||
Object? equipmentName = null,
|
||||
Object? scheduledDate = null,
|
||||
Object? maintenanceType = null,
|
||||
Object? daysUntil = null,
|
||||
Object? priority = null,
|
||||
Object? description = freezed,
|
||||
Object? estimatedCost = freezed,
|
||||
}) {
|
||||
return _then(_$MaintenanceAlertImpl(
|
||||
maintenanceId: null == maintenanceId
|
||||
? _value.maintenanceId
|
||||
: maintenanceId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentHistoryId: null == equipmentHistoryId
|
||||
? _value.equipmentHistoryId
|
||||
: equipmentHistoryId // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
equipmentName: null == equipmentName
|
||||
? _value.equipmentName
|
||||
: equipmentName // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
scheduledDate: null == scheduledDate
|
||||
? _value.scheduledDate
|
||||
: scheduledDate // ignore: cast_nullable_to_non_nullable
|
||||
as DateTime,
|
||||
maintenanceType: null == maintenanceType
|
||||
? _value.maintenanceType
|
||||
: maintenanceType // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
daysUntil: null == daysUntil
|
||||
? _value.daysUntil
|
||||
: daysUntil // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
priority: null == priority
|
||||
? _value.priority
|
||||
: priority // ignore: cast_nullable_to_non_nullable
|
||||
as AlertPriority,
|
||||
description: freezed == description
|
||||
? _value.description
|
||||
: description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
estimatedCost: freezed == estimatedCost
|
||||
? _value.estimatedCost
|
||||
: estimatedCost // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
class _$MaintenanceAlertImpl extends _MaintenanceAlert {
|
||||
const _$MaintenanceAlertImpl(
|
||||
{required this.maintenanceId,
|
||||
required this.equipmentHistoryId,
|
||||
required this.equipmentName,
|
||||
required this.scheduledDate,
|
||||
required this.maintenanceType,
|
||||
required this.daysUntil,
|
||||
required this.priority,
|
||||
this.description,
|
||||
this.estimatedCost})
|
||||
: super._();
|
||||
|
||||
@override
|
||||
final int maintenanceId;
|
||||
@override
|
||||
final int equipmentHistoryId;
|
||||
@override
|
||||
final String equipmentName;
|
||||
@override
|
||||
final DateTime scheduledDate;
|
||||
@override
|
||||
final String maintenanceType;
|
||||
@override
|
||||
final int daysUntil;
|
||||
@override
|
||||
final AlertPriority priority;
|
||||
@override
|
||||
final String? description;
|
||||
@override
|
||||
final double? estimatedCost;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'MaintenanceAlert(maintenanceId: $maintenanceId, equipmentHistoryId: $equipmentHistoryId, equipmentName: $equipmentName, scheduledDate: $scheduledDate, maintenanceType: $maintenanceType, daysUntil: $daysUntil, priority: $priority, description: $description, estimatedCost: $estimatedCost)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$MaintenanceAlertImpl &&
|
||||
(identical(other.maintenanceId, maintenanceId) ||
|
||||
other.maintenanceId == maintenanceId) &&
|
||||
(identical(other.equipmentHistoryId, equipmentHistoryId) ||
|
||||
other.equipmentHistoryId == equipmentHistoryId) &&
|
||||
(identical(other.equipmentName, equipmentName) ||
|
||||
other.equipmentName == equipmentName) &&
|
||||
(identical(other.scheduledDate, scheduledDate) ||
|
||||
other.scheduledDate == scheduledDate) &&
|
||||
(identical(other.maintenanceType, maintenanceType) ||
|
||||
other.maintenanceType == maintenanceType) &&
|
||||
(identical(other.daysUntil, daysUntil) ||
|
||||
other.daysUntil == daysUntil) &&
|
||||
(identical(other.priority, priority) ||
|
||||
other.priority == priority) &&
|
||||
(identical(other.description, description) ||
|
||||
other.description == description) &&
|
||||
(identical(other.estimatedCost, estimatedCost) ||
|
||||
other.estimatedCost == estimatedCost));
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
maintenanceId,
|
||||
equipmentHistoryId,
|
||||
equipmentName,
|
||||
scheduledDate,
|
||||
maintenanceType,
|
||||
daysUntil,
|
||||
priority,
|
||||
description,
|
||||
estimatedCost);
|
||||
|
||||
/// Create a copy of MaintenanceAlert
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$MaintenanceAlertImplCopyWith<_$MaintenanceAlertImpl> get copyWith =>
|
||||
__$$MaintenanceAlertImplCopyWithImpl<_$MaintenanceAlertImpl>(
|
||||
this, _$identity);
|
||||
}
|
||||
|
||||
abstract class _MaintenanceAlert extends MaintenanceAlert {
|
||||
const factory _MaintenanceAlert(
|
||||
{required final int maintenanceId,
|
||||
required final int equipmentHistoryId,
|
||||
required final String equipmentName,
|
||||
required final DateTime scheduledDate,
|
||||
required final String maintenanceType,
|
||||
required final int daysUntil,
|
||||
required final AlertPriority priority,
|
||||
final String? description,
|
||||
final double? estimatedCost}) = _$MaintenanceAlertImpl;
|
||||
const _MaintenanceAlert._() : super._();
|
||||
|
||||
@override
|
||||
int get maintenanceId;
|
||||
@override
|
||||
int get equipmentHistoryId;
|
||||
@override
|
||||
String get equipmentName;
|
||||
@override
|
||||
DateTime get scheduledDate;
|
||||
@override
|
||||
String get maintenanceType;
|
||||
@override
|
||||
int get daysUntil;
|
||||
@override
|
||||
AlertPriority get priority;
|
||||
@override
|
||||
String? get description;
|
||||
@override
|
||||
double? get estimatedCost;
|
||||
|
||||
/// Create a copy of MaintenanceAlert
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
_$$MaintenanceAlertImplCopyWith<_$MaintenanceAlertImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
Reference in New Issue
Block a user