/* ============================================================================= * B05_Profile/logic/B05_Profile_Route_Reset.ts * 노선 초기화 = 추천 [적용](요구 289 · 493-2) — 확인 창 글 · 적용 뒤 알림 글. * * 손 고침 [저장]은 보이는 화면 그대로 저장(초기화 없음) — 초기화 기준 = 추천 [적용]만. * 지워질 수 = 서버 저장분(서버가 지우는 것 · 응답 `route_reset.dropped` 와 같은 셈). * ========================================================================== */ /** 서버 저장분에서 지워질 수 — 사용자 구조물 · 관 · 추가 측점(응답 `route_reset.dropped` 와 같은 칸). */ export interface RouteResetCounts { structures: number; pipes: number; plusStations: number; } /** 서버 응답 `route_reset` — 초기화했나 · 지운 수. */ export interface RouteReset { reset: boolean; dropped?: { structures?: number; pipes?: number; plus_stations?: number }; } /** 추천 [적용] 확인 창 글. */ export function routeResetConfirmText(counts: RouteResetCounts): string { return ( `추천 노선을 [적용]하면 초기화합니다 — 구조물 ${counts.structures} · 관 ${counts.pipes} · ` + `추가 측점 ${counts.plusStations} · 종단 · 횡단 손 입력이 지워지고 ` + `새 노선으로 다시 셉니다(세류선 교차 관 · 측점 · 초기 종단 · 횡단). 적용할까요?` ); } /** 적용 뒤 알림 한 줄 — 초기화가 아니면 null. */ export function routeResetNotice( reset: RouteReset | null | undefined, crossing = 0, ): string | null { if (!reset?.reset) return null; const dropped = reset.dropped ?? {}; return ( `노선이 바뀌어 초기화했습니다 — 지움: 구조물 ${dropped.structures ?? 0} · 관 ${dropped.pipes ?? 0} · ` + `추가 측점 ${dropped.plus_stations ?? 0} · 새 교차 관 ${crossing}` ); }