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

/// 결재 진행 가능 여부(can-proceed) 응답 DTO.
class ApprovalProceedStatusDto {
  ApprovalProceedStatusDto({
    required this.approvalId,
    required this.canProceed,
    this.reason,
  });

  final int approvalId;
  final bool canProceed;
  final String? reason;

  factory ApprovalProceedStatusDto.fromJson(Map<String, dynamic> json) {
    return ApprovalProceedStatusDto(
      approvalId: json['id'] as int? ?? json['approval_id'] as int? ?? 0,
      canProceed: json['can_proceed'] as bool? ?? false,
      reason: json['reason'] as String?,
    );
  }

  ApprovalProceedStatus toEntity() => ApprovalProceedStatus(
    approvalId: approvalId,
    canProceed: canProceed,
    reason: reason,
  );
}
