-- 三大 IP 数据（示意性 MVP 数据）

-- 1) 回归状态
-- 海外机构（大英 016、大都会 027、卢浮宫 028、东博 029、弗利尔 030）所藏 → 流失海外
UPDATE artifacts SET repatriation_status = 'lost_overseas'
WHERE id IN (
  SELECT a.id FROM artifacts a
  JOIN artifact_locations al ON a.id = al.artifact_id AND al.is_current = true
  WHERE al.location_type = 'overseas'
);
-- 已回归代表：皿方罍（b...010，2014 完罍归湘）
UPDATE artifacts SET repatriation_status = 'repatriated' WHERE id = 'b0000000-0000-0000-0000-000000000010';

-- 2) 叙事路线：故宫文物南迁之路（migration）
DELETE FROM route_stops WHERE route_id IN (SELECT id FROM narrative_routes WHERE code IN ('nanqian','huigui'));
DELETE FROM narrative_routes WHERE code IN ('nanqian','huigui');

INSERT INTO narrative_routes (id, code, title, type, color, summary) VALUES
  ('d0000000-0000-0000-0000-000000000001','nanqian','故宫文物南迁之路','migration','#e0b15a',
   '1933—1947 年，故宫等机构为避战火，将上万箱文物分路南迁、西迁，辗转上海、南京、宝鸡、汉中、成都、峨眉、重庆等地，行程逾万里，历经十余年，国宝几无损失，被誉为人类文明守护史上的奇迹。'),
  ('d0000000-0000-0000-0000-000000000002','huigui','国宝回归之路','repatriation','#3f9e6a',
   '从流失海外到重返故土——以皿方罍为代表，器身与器盖分离近一个世纪，2014 年器盖由海外回归、与器身在湖南合体，"完罍归湘"，成为国宝回归的标志性事件。')
ON CONFLICT (code) DO NOTHING;

INSERT INTO route_stops (route_id, seq, name, lng, lat, year_label, event) VALUES
  ('d0000000-0000-0000-0000-000000000001',1,'北京·紫禁城',116.3972,39.9163,'1933','13427 箱文物分批南迁起运'),
  ('d0000000-0000-0000-0000-000000000001',2,'上海',121.4737,31.2293,'1933—1936','暂存法租界与天主堂街库房'),
  ('d0000000-0000-0000-0000-000000000001',3,'南京·朝天宫',118.7780,32.0300,'1936—1937','迁入朝天宫库房，旋因战事再迁'),
  ('d0000000-0000-0000-0000-000000000001',4,'宝鸡',107.1444,34.3693,'1937—1938','北路西迁，翻越秦岭'),
  ('d0000000-0000-0000-0000-000000000001',5,'汉中',107.0238,33.0678,'1938','转运途中遭遇空袭与塌方'),
  ('d0000000-0000-0000-0000-000000000001',6,'成都',104.0665,30.6623,'1938','中路文物暂存'),
  ('d0000000-0000-0000-0000-000000000001',7,'峨眉',103.4844,29.6010,'1939—1946','南路文物存于峨眉，安然度过战火'),
  ('d0000000-0000-0000-0000-000000000001',8,'重庆',106.5516,29.5647,'1938—1946','中路文物存于巴县、乐山一带'),
  ('d0000000-0000-0000-0000-000000000001',9,'南京（回迁）',118.7780,32.0300,'1947','抗战胜利后文物东归南京');

INSERT INTO route_stops (route_id, seq, name, lng, lat, year_label, event) VALUES
  ('d0000000-0000-0000-0000-000000000002',1,'海外（流失）',2.3376,48.8606,'1920s','器盖流散海外，辗转于私人藏家与拍卖行'),
  ('d0000000-0000-0000-0000-000000000002',2,'纽约',-73.9632,40.7794,'2014','现身纽约拍卖，国内多方紧急斡旋'),
  ('d0000000-0000-0000-0000-000000000002',3,'香港',114.1694,22.3193,'2014','达成洽购协议，护送入境'),
  ('d0000000-0000-0000-0000-000000000002',4,'北京',116.4074,39.9052,'2014','回归交接仪式'),
  ('d0000000-0000-0000-0000-000000000002',5,'长沙·湖南博物院',112.9838,28.2082,'2014','器身器盖合体，完罍归湘');
