import '../core/models.dart';
/// 教程第19章实战案例 — 出生时刻已按排盘引擎回校准
/// © 2026 Jason Li. All rights reserved.

class TutorialCase {
  final String id;
  final String titleZh;
  final String titleEn;
  final String titleJa;
  final BirthInput input;
  final String expectedPillars;
  final List<String> notesZh;

  const TutorialCase({
    required this.id,
    required this.titleZh,
    required this.titleEn,
    required this.titleJa,
    required this.input,
    required this.expectedPillars,
    this.notesZh = const [],
  });
}

class TutorialCases {
  static final jason = TutorialCase(
    id: 'jason',
    titleZh: '编著命局（甲日主男命）',
    titleEn: "Author's chart (Jia day, male)",
    titleJa: '著者命局（甲日主・男命）',
    input: BirthInput(
      name: 'Jason Li',
      localDateTime: DateTime(1973, 10, 15, 12, 0),
      longitude: 116.4,
      latitude: 39.9,
      gender: Gender.male,
      placeName: 'Beijing',
    ),
    expectedPillars: '癸丑 壬戌 甲申 庚午',
    notesZh: [
      '父戊（戌中藏）、母癸（年干）、正妻己（丑中藏）',
      '子庚（时干）、女辛（戌中藏）',
      '兄壬（月干叙事）、姐癸（年干）',
    ],
  );

  /// 回校准：北京 1968-11-03 丑时 → 戊申 壬戌 丁丑 辛丑
  static final brother = TutorialCase(
    id: 'brother',
    titleZh: '哥哥命局（丁日主男命）',
    titleEn: "Brother's chart (Ding day, male)",
    titleJa: '兄命局（丁日主・男命）',
    input: BirthInput(
      name: 'Brother',
      localDateTime: DateTime(1968, 11, 3, 2, 0),
      longitude: 116.4,
      latitude: 39.9,
      gender: Gender.male,
      placeName: 'Beijing',
    ),
    expectedPillars: '戊申 壬戌 丁丑 辛丑',
    notesZh: [
      '出生时刻已自动回校：1968-11-03 02:00 北京',
      '父辛（时干）、母甲（表）；月干壬与日干丁合木',
      '正妻庚（申中藏）、女壬、子癸（丑中藏）',
    ],
  );

  /// 回校准：北京 1933-05-31 23:00（子时）→ 癸酉 丁巳 戊戌 壬子
  static final father = TutorialCase(
    id: 'father',
    titleZh: '父亲命局（戊日主男命）',
    titleEn: "Father's chart (Wu day, male)",
    titleJa: '父命局（戊日主・男命）',
    input: BirthInput(
      name: 'Father',
      localDateTime: DateTime(1933, 5, 31, 23, 0),
      longitude: 116.4,
      latitude: 39.9,
      gender: Gender.male,
      placeName: 'Beijing',
    ),
    expectedPillars: '癸酉 丁巳 戊戌 壬子',
    notesZh: [
      '出生时刻已自动回校：1933-05-31 23:00 北京（子时）',
      '亡日机制参考：2023-03-17 丑时',
      '三重卯木合戌 + 丑戌刑 + 子丑合土',
    ],
  );

  static List<TutorialCase> get all => [jason, brother, father];
}

/// 教程12.3全球示例 — 墨尔本日时已按子午线公式更正
class GlobalChartExample {
  final String nameZh;
  final DateTime localDateTime;
  final double longitude;
  final double latitude;
  final String expectedPillars;
  final String note;

  const GlobalChartExample({
    required this.nameZh,
    required this.localDateTime,
    required this.longitude,
    required this.latitude,
    required this.expectedPillars,
    this.note = '',
  });
}

class GlobalChartExamples {
  static final all = <GlobalChartExample>[
    GlobalChartExample(
      nameZh: '北京',
      localDateTime: DateTime(2008, 12, 3, 2, 8),
      longitude: 116.0,
      latitude: 39.9,
      expectedPillars: '戊子 癸亥 丁丑 辛丑',
    ),
    GlobalChartExample(
      nameZh: '芝加哥',
      localDateTime: DateTime(2008, 12, 3, 2, 8),
      longitude: -87.0,
      latitude: 41.8,
      expectedPillars: '戊子 癸亥 戊寅 癸丑',
    ),
    GlobalChartExample(
      nameZh: '伦敦',
      localDateTime: DateTime(2008, 12, 3, 2, 8),
      longitude: 0.0,
      latitude: 51.5,
      expectedPillars: '戊子 癸亥 丁丑 辛丑',
    ),
    GlobalChartExample(
      nameZh: '墨尔本',
      localDateTime: DateTime(2008, 12, 3, 2, 8),
      longitude: 145.0,
      latitude: -37.8,
      // 原文误作「戊寅 癸丑」（同芝加哥）；按东经120°公式更正为丁丑辛丑
      expectedPillars: '戊子 癸巳 丁丑 辛丑',
      note: '已更正教程日时笔误；月支南半球对冲亥→巳',
    ),
  ];
}
