#pragma once

namespace xtr::dialog {

//! Dialog: Select constituenta from typification
class InsertCstDlg final : public CDialog {
public:
  CString cstName{};

private:
  const ccl::semantic::RSCore& context;
  CListBox pickerControl{};

  enum State : uint8_t {
    DS_DEFAULT = 0,
    DS_CSTS,
  };
  State state{ DS_DEFAULT };

  CPoint position{};
  CString hint{};

  std::vector<CString> typifications{};
  CString choice{};

public:
  InsertCstDlg(const ccl::semantic::RSCore& context, CPoint pos,
               CString hint, CWnd* pParent = nullptr);

private:
  BOOL OnInitDialog() override;
  void DoDataExchange(CDataExchange* pDX) override;
  BOOL PreTranslateMessage(MSG* pMsg) override;

private:
  void FitDialogSize();
  void OnSelectTyping();
  void OnSelectCst();

  void UpdateContextNameList();
  void UpdateTypingNameList();
};

} // namespace xtr::dialog