#ifndef ESCHER_WARNING_CONTROLLER_H
#define ESCHER_WARNING_CONTROLLER_H

#include <escher/view_controller.h>
#include <escher/message_text_view.h>
#include <escher/solid_color_view.h>
#include <escher/i18n.h>

class WarningController : public ViewController {
public:
  WarningController(Responder * parentResponder, I18n::Message warningMessage1, I18n::Message warningMessage2 = (I18n::Message)0);
  void setLabel(I18n::Message message1, I18n::Message message2, bool specialExitKeys);
  const char * title() override;
  View * view() override;
  bool handleEvent(Ion::Events::Event event) override;
private:
  class ContentView : public SolidColorView {
  public:
    ContentView();
    void setLabels(I18n::Message message1, I18n::Message message2);
    int numberOfSubviews() const override;
    View * subviewAtIndex(int index) override;
    void layoutSubviews() override;
    KDSize minimalSizeForOptimalDisplay() const override;
  private:
    constexpr static KDCoordinate k_topAndBottomMargin = 20;
    constexpr static KDCoordinate k_middleMargin = 10;
    constexpr static KDCoordinate k_horizontalMargin = 20;
    constexpr static float k_middleAlignment = 0.5f;
    constexpr static float k_shiftedAlignment = 0.7f; // = (k_topAndBottomMargin + textHeight/2)/(k_topAndBottomMargin + textHeight + 0.5*k_middleMargin)
    MessageTextView m_textView1;
    MessageTextView m_textView2;
  };

  ContentView m_contentView;
  I18n::Message m_warningMessage1;
  bool m_exitOnOKBackEXE;
};

#endif
