#pragma once

namespace xtr::dialog {

//! Choose companion word data options
class WordRefDlg final : public CDialog {
private:
  CEdit textControl;
  RECT position;

  CString dependantWord;
  int16_t offset{ 0 };

public:
  WordRefDlg(RECT position, CString selection, CWnd* pParent = nullptr);

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

public:
  [[nodiscard]] ccl::lang::Reference CreateRef() const;

private:
  BOOL PreTranslateMessage(MSG* pMsg) override;

private:
  void SetPositionAndSize();
  void SelectOffset();
};

//! Select companion offset
class RefOffsetDlg final : public CDialog {
public:
  int16_t offset{ 0 };

private:
  CString offsetText{ L"<- ->" };
  CStatic textControl;
  RECT position;

public:
  explicit  RefOffsetDlg(RECT position, CWnd* pParent = nullptr);

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

private:
  void SetPositionAndSize();
  void UpdateOffset(BOOL decrease);
};

} // namespace xtr::dialog