import '../../../common/domain/metal_type.dart';

enum MarketPeriod {
  h24('24h', '24时'),
  d5('5d', '5日'),
  m1('1m', '1月'),
  m3('3m', '3月'),
  y1('1y', '1年');

  const MarketPeriod(this.id, this.label);

  final String id;
  final String label;
}

enum ExchangeChannelKind { spot, bar, retail, td, recycle }

class MetalQuote {
  const MetalQuote({
    required this.metal,
    required this.spotPrice,
    required this.changeAmount,
    required this.changePercent,
    required this.updatedAt,
    required this.sourceLabel,
    required this.basisLabel,
  });

  final MetalType metal;
  final double spotPrice;
  final double changeAmount;
  final double changePercent;
  final DateTime updatedAt;
  final String sourceLabel;
  final String basisLabel;
}

class MarketPoint {
  const MarketPoint({
    required this.time,
    required this.open,
    required this.high,
    required this.low,
    required this.close,
  });

  final DateTime time;
  final double open;
  final double high;
  final double low;
  final double close;
}

class ExchangeChannel {
  const ExchangeChannel({
    required this.id,
    required this.metal,
    required this.name,
    required this.kind,
    required this.pricePerGram,
    required this.source,
    required this.updatedAt,
    required this.hint,
  });

  final String id;
  final MetalType metal;
  final String name;
  final ExchangeChannelKind kind;
  final double pricePerGram;
  final String source;
  final DateTime updatedAt;
  final String hint;
}
