import 'package:flutter/material.dart';

import 'package:doormile/core/theme/app_colors.dart';

/// A saved or recent address entry.
class AddressEntry {
  final String label; // e.g. "Home", "Work"
  final String line; // full address line
  final IconData icon;
  final Color iconBg;
  final Color iconColor;
  final double latitude;
  final double longitude;
  final String pincode;

  const AddressEntry({
    required this.label,
    required this.line,
    required this.icon,
    this.iconBg = AppColors.surfaceContainer,
    this.iconColor = AppColors.onSurfaceVariant,
    this.latitude = 0.0,
    this.longitude = 0.0,
    this.pincode = '',
  });
}

enum OrderStatus { active, delivered, cancelled }

extension OrderStatusX on OrderStatus {
  String get label => switch (this) {
        OrderStatus.active => 'In Transit',
        OrderStatus.delivered => 'Delivered',
        OrderStatus.cancelled => 'Cancelled',
      };

  Color get color => switch (this) {
        OrderStatus.active => AppColors.tertiary,
        OrderStatus.delivered => AppColors.success,
        OrderStatus.cancelled => AppColors.error,
      };

  Color get bg => switch (this) {
        OrderStatus.active => AppColors.tertiaryFixed,
        OrderStatus.delivered => const Color(0xFFE3F6EC),
        OrderStatus.cancelled => AppColors.errorContainer,
      };
}

/// One stop in a shipment journey timeline.
class JourneyStep {
  final String title;
  final String subtitle;
  final String time;
  final IconData icon;
  final Color color;
  final bool done;
  final bool active;
  final String? note;

  const JourneyStep({
    required this.title,
    required this.subtitle,
    required this.time,
    required this.icon,
    required this.color,
    this.done = false,
    this.active = false,
    this.note,
  });
}

class ActivityLog {
  final String title;
  final String subtitle;
  final IconData icon;
  const ActivityLog(this.title, this.subtitle, this.icon);
}

/// A parcel order.
class Order {
  final String id;
  final String fromLabel;
  final String fromSub;
  final String toLabel;
  final String toSub;
  final String date;
  final double amount;
  final OrderStatus status;
  final String parcelType;
  final String weight;
  final String size;
  final double progress; // 0..1
  final String co2Saved;
  final String eta;
  final bool ecoRoute;

  const Order({
    required this.id,
    required this.fromLabel,
    required this.fromSub,
    required this.toLabel,
    required this.toSub,
    required this.date,
    required this.amount,
    required this.status,
    this.parcelType = 'Documents',
    this.weight = '0–1 kg',
    this.size = 'Small',
    this.progress = 0.0,
    this.co2Saved = '0.8kg',
    this.eta = '—',
    this.ecoRoute = true,
  });
}


class FaqItem {
  final String question;
  final String answer;
  const FaqItem(this.question, this.answer);
}

class ChatMessage {
  final String text;
  final bool fromUser;
  const ChatMessage(this.text, {this.fromUser = false});
}
