/// Order Status Model
///
/// Data model for order status from API responses.
library;

import 'package:equatable/equatable.dart';
import 'package:worker/features/orders/domain/entities/order_status.dart';

/// Order Status Model
class OrderStatusModel extends Equatable {
  final String status;
  final String label;
  final String color;
  final int index;

  const OrderStatusModel({
    required this.status,
    required this.label,
    required this.color,
    required this.index,
  });

  /// Create from JSON
  factory OrderStatusModel.fromJson(Map<String, dynamic> json) {
    return OrderStatusModel(
      status: json['status'] as String,
      label: json['label'] as String,
      color: json['color'] as String,
      index: json['index'] as int,
    );
  }

  /// Convert to JSON
  Map<String, dynamic> toJson() {
    return {
      'status': status,
      'label': label,
      'color': color,
      'index': index,
    };
  }

  /// Convert to entity
  OrderStatus toEntity() {
    return OrderStatus(
      status: status,
      label: label,
      color: color,
      index: index,
    );
  }

  /// Create from entity
  factory OrderStatusModel.fromEntity(OrderStatus entity) {
    return OrderStatusModel(
      status: entity.status,
      label: entity.label,
      color: entity.color,
      index: entity.index,
    );
  }

  @override
  List<Object?> get props => [status, label, color, index];
}
