import '../../../domain/entities/approval.dart';

/// 결재 이력 레코드
///
/// - 결재별 단계 변경 로그를 목록 화면에서 표시하기 위한 모델이다.
class ApprovalHistoryRecord {
  ApprovalHistoryRecord({
    required this.id,
    required this.approvalId,
    required this.approvalNo,
    this.stepOrder,
    required this.action,
    this.fromStatus,
    required this.toStatus,
    required this.approver,
    required this.actionAt,
    this.note,
  });

  final int id;
  final int approvalId;
  final String approvalNo;
  final int? stepOrder;
  final ApprovalAction action;
  final ApprovalStatus? fromStatus;
  final ApprovalStatus toStatus;
  final ApprovalApprover approver;
  final DateTime actionAt;
  final String? note;

  ApprovalHistoryRecord copyWith({
    int? id,
    int? approvalId,
    String? approvalNo,
    int? stepOrder,
    ApprovalAction? action,
    ApprovalStatus? fromStatus,
    ApprovalStatus? toStatus,
    ApprovalApprover? approver,
    DateTime? actionAt,
    String? note,
  }) {
    return ApprovalHistoryRecord(
      id: id ?? this.id,
      approvalId: approvalId ?? this.approvalId,
      approvalNo: approvalNo ?? this.approvalNo,
      stepOrder: stepOrder ?? this.stepOrder,
      action: action ?? this.action,
      fromStatus: fromStatus ?? this.fromStatus,
      toStatus: toStatus ?? this.toStatus,
      approver: approver ?? this.approver,
      actionAt: actionAt ?? this.actionAt,
      note: note ?? this.note,
    );
  }
}
