using SheetMe.Core.Catalog;
namespace SheetMe.Designer.ViewModels.Inspector;
/// 인스펙터 상단 탭
public enum InspectorTab
{
/// 화면에 어떻게 보이는가 — 글자·색·정렬·테두리·크기·표시 형식
Design,
/// 무슨 값이 채워지는가 — 자동 채움 원천, 조회, 초기값, 입력 형식·검증, 저장 대상
Data,
/// 조작하면 무슨 일이 일어나는가 — 액션 태그, 대상 컨트롤, 단축키
Behavior,
}
///
/// 속성 → 인스펙터 탭 분류.
///
/// Core 에 두지 않는다. ControlRegistry 는 UI 무관하게 유지하고 표시 계층인 여기서만
/// 매핑한다(PaletteIconCatalog 와 같은 선례). 탭 구성은 화면 사정이지 서식 데이터의 성질이 아니다.
///
/// 분류가 틀리면 탭이 없느니만 못하다 — 사용자가 속성 하나를 찾아 세 탭을 다 뒤지게 된다.
/// 그래서 키를 하나씩 명시하고, 모르는 키는 이 아니라
/// 편집기 종류로 추론한다(사이트가 추가한 커스텀 속성 대비).
///
public static class InspectorTabCatalog
{
#region Member Fields
private static readonly Dictionary Map = new(StringComparer.Ordinal)
{
// ── 디자인: 화면에 어떻게 보이는가 ──
["Text"] = InspectorTab.Design, // 라벨·버튼·그룹상자 표시 문구
["TextAlign"] = InspectorTab.Design,
["ForeColor"] = InspectorTab.Design,
["BackColor"] = InspectorTab.Design,
["LineColor"] = InspectorTab.Design,
["BorderStyle"] = InspectorTab.Design,
["SizeMode"] = InspectorTab.Design, // 이미지 맞춤 방식
["Format"] = InspectorTab.Design, // 날짜 표시 형식
["CustomFormat"] = InspectorTab.Design,
["Multiline"] = InspectorTab.Design, // 여러 줄로 '보이는가'
["AutoHeight"] = InspectorTab.Design, // 내용에 맞춰 높이가 늘어나는가
// 표시 여부는 '어떻게 보이는가'의 일부다. 라벨만 소문자 키를 쓴다(Label.vb 의 Shadows 속성).
["Visible"] = InspectorTab.Design,
["visible"] = InspectorTab.Design,
// 화면이 아니라 종이에 나오는가 — 성격은 표시 여부와 같은 축이다
["PrintOutPut"] = InspectorTab.Design,
// 선 3종
["Orientation"] = InspectorTab.Design,
["BorderWidth"] = InspectorTab.Design,
["DashStyle"] = InspectorTab.Design,
// ── 데이터: 무슨 값이 채워지는가 ──
["DataInterfaceTag"] = InspectorTab.Data, // 자동 채움 원천
["DataTableField"] = InspectorTab.Data, // 저장 대상 필드
["Query"] = InspectorTab.Data,
["ExcuteQuery"] = InspectorTab.Data,
["InitialValue"] = InspectorTab.Data,
["Mask"] = InspectorTab.Data, // 입력 형식
["IsRequiredValue"] = InspectorTab.Data, // 검증
["Items"] = InspectorTab.Data, // 고를 수 있는 값 목록
["Checked"] = InspectorTab.Data, // 기본 체크 = 초기값
["Score"] = InspectorTab.Data, // 설문 배점
["ItemScore"] = InspectorTab.Data, // 콤보 항목별 배점("/" 구분, 항목 순서와 1:1)
["Formula"] = InspectorTab.Data, // 다른 컨트롤의 Score 를 합산해 이 칸의 값을 만든다
["IsSignature"] = InspectorTab.Data, // 이 칸에 채워지는 것이 서명 이미지인가
["SignatureIndex"] = InspectorTab.Data,
// 저장된 기록을 다시 열 때 값을 어디서 가져오는가 — 저장된 값인가, 지금 조회한 값인가
["ReLoadDataOnSavedSheet"] = InspectorTab.Data,
["ReLoadDataOnViewMode"] = InspectorTab.Data,
["ReLoadDataMsgNoCheck"] = InspectorTab.Data,
// ── 동작: 조작하면 무슨 일이 일어나는가 ──
["DataActionTag"] = InspectorTab.Behavior,
["DataActionTagControl"] = InspectorTab.Behavior,
["GetDataActionTagControl"] = InspectorTab.Behavior,
["KeyboardShortcut"] = InspectorTab.Behavior,
// 상용구 2종은 이름이 '입력 보조'처럼 보이지만 레거시에서는 조작 훅이다.
// RwdRsvWrdYon 은 포커스(Enter) 핸들러 부착 게이트라 상용구 창이 이 칸에 연동되고,
// RwdOrderAutYon 은 상용구를 고른 결과로 OCS 처방을 전송하는 게이트다.
["RwdRsvWrdYon"] = InspectorTab.Behavior,
["RwdOrderAutYon"] = InspectorTab.Behavior,
// 읽기 전용은 '입력을 받는가'라서 동작이다(TextBox 에서는 곧 ReadOnly 다)
["PreventEditing"] = InspectorTab.Behavior,
};
#endregion
#region Methods
/// 속성이 속한 탭
public static InspectorTab TabOf(PropertyDef def)
{
if (Map.TryGetValue(def.Key, out var tab))
{
return tab;
}
// 목록에 없는 키(사이트 커스텀 등)는 편집기 종류로 추론한다 — 무조건 디자인으로 보내면
// 성격이 다른 속성이 디자인 탭에 쌓인다.
return def.Editor switch
{
PropEditorKind.DataActionTag => InspectorTab.Behavior,
PropEditorKind.DataInterfaceTag or PropEditorKind.SqlQuery or PropEditorKind.Mask
=> InspectorTab.Data,
_ => InspectorTab.Design,
};
}
#endregion
}