#pragma once

#include "xtr/doc/OSSDoc.h"

#include "xtr/ui/RSEdit.h"
#include "xtr/ui/RSListCtrl.h"

namespace xtr::view {

//! View: OSS pictogramm
class PictView final: public CFormView {
  DECLARE_DYNCREATE(PictView)

  struct TableHeader;

  ccl::oss::OSSchema* oss{ nullptr };

  CListCtrl optionsCtrl;
  CEdit fullNameCtrl;
  CEdit shortNameCtrl;
  CEdit ossNameCtrl;
  CEdit opStatusCtrl;
  CEdit operationCtrl;
  ui::RSEdit commentCtrl;
  CButton  changeFileBtn;

  CString ossTitle;
  CString pictAlias;
  CString pictTitle;
  CString operand1;
  CString operand2;
  CString status;
  CString opType;
  CString dataType;
  CString comment;

private:
  PictView();

private:
  void DoDataExchange(CDataExchange* pDX) override;
  void LoadData();
  void LoadOperation();
  void SaveData();
  void UpdateUI();
  void OnInitialUpdate() override;
  void InitMapCtrl();
  void InitCommentCtrl();

private:
  void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) override;

DECLARE_MESSAGE_MAP()
  afx_msg void OpenHelp();
  afx_msg void OnChange();
  afx_msg void OnOSSComment();
  afx_msg void OnPictLink();
  afx_msg void OnOSSFileName();
  afx_msg void OnPictFileName();
  afx_msg void OnOpenOSSFolder();
  afx_msg void OnBackup();

private:
  doc::OSSDoc& Document() noexcept;
  void UpdateMapCtrl(ccl::oss::PictID pid);
};

} // namespace xtr::view