using System;

using CommonHelpers;

namespace ConsoleCalculator {

//**************************************************************************************************
/// <summary>
/// Main class in this program (however, application entry point is in "Startup" class).
/// </summary>
static partial class Program {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static HConsole CON => HConsole.StdConIO;
//==================================================================================================
// CONSTANTS:

const string
   _InputPrimaryOperand_Message_ = "Input primary operand",
   _InputOperand_Message_        = "Input operand",
   _PressOperationKey_Message_   = "Press operation key";

//--------------------------------------------------------------------------------------------------
// STATIC READONLY FIELDS:

static readonly string[]
   _OperationCaptions_=
   {
      "- (invert sign)",
      "+ (plus)",
      "- (minus)",
      "* (multiply by)",
      "/ (divide by)",
      "Power (raise to)",
      "<< Repeat last operation >>",
      "<< One operation back >>"
   };

static readonly ConsoleKey[]
   _MainOperationKeyArray_ =
   {
      ConsoleKey.Subtract, // unary -
      ConsoleKey.Add,      // +
      ConsoleKey.Subtract, // -
      ConsoleKey.Multiply, // *
      ConsoleKey.Divide,   // /
      ConsoleKey.Multiply, // power
      ConsoleKey.Enter,    // repeate last operation
      ConsoleKey.Backspace // one operation back
   },
   _AltOperationKeyArray_ =
   {
      ConsoleKey.OemMinus, // unary -
      ConsoleKey.OemPlus,  // +
      ConsoleKey.OemMinus, // -
      ConsoleKey.D8,       // *
      ConsoleKey.Oem2,     // /
      ConsoleKey.D8,       // power
      ConsoleKey.Enter,    // repeate last operation
      ConsoleKey.Backspace // one operation back
   },
   _OperationKeyArray_ = HArray.Concatenate
   (
      _MainOperationKeyArray_,
      _AltOperationKeyArray_
   );

static readonly ConsoleModifiers[]
   _MainOperationModifierArray_ =
   {
      ConsoleModifiers.Control, // unary -
      0,                        // +
      0,                        // -
      0,                        // *
      0,                        // /
      ConsoleModifiers.Control, // power
      0,                        // repeate last operation
      0                         // one operation back
   },
   _OperationModifierArray_ = HArray.Concatenate
   (
      _MainOperationModifierArray_,
      _MainOperationModifierArray_
   );

static readonly int
   _MaxInputCaptionLength_ = HString.MaxLength
   (
      _InputPrimaryOperand_Message_,
      _InputOperand_Message_,
      _PressOperationKey_Message_
   );

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // Program
//**************************************************************************************************

} // ConsoleCalculator
