// ===================================================================
// Class for storing data of one parol qualifier pair ("first", "second")
// and its rating (count of "yes", "maybe", "no" rate).

var Bible20;
if (!Bible20) {
  Bible20 = {};
}
else if (typeof Bible20 != "object") {
  throw new Error("Bible20 already exists and is not an object");
}

if (!Bible20.Pair) {
  Bible20.Pair = {};
}
else if (typeof Bible20.Pair != "object") {
  throw new Error("Bible20.Pair already exists and is not an object");
}

Bible20.Pair.Pair = function(firstQual, secondQual)
{
  try {
    this._firstQual  = firstQual;
    this._secondQual = secondQual;
    this._Order   = null;
    this._Type    = null;
    this._Yes     = 0;
    this._Maybe   = 0;
    this._No      = 0;
    // save space, do not set _UserRate and _Comment
    
    // cache:
    // this._firstParol
    // this._secondParol
    // this._firstBibleRef
    // this._secondBibleRef
  }
  catch (e) {
    alert("Pair: " + e);
  }
}

Bible20.Pair.Pair.prototype =
{
  toString: function()
  {
    return "Pair(" + this._firstQual + ", " + this._secondQual + ")";
  },


  // --- getter ---

  getFirst: function()
  {
    return this._firstQual;
  },

  getSecond: function()
  {
    return this._secondQual;
  },

  getOrder: function()
  {
    return this._Order;
  },

  getType: function()
  {
    return this._Type;
  },

  getYes: function()
  {
    return this._Yes;
  },

  getMaybe: function()
  {
    return this._Maybe;
  },

  getNo: function()
  {
    return this._No;
  },

  // null/undefined if no user rate
  getUserRate: function()
  {
    return this._UserRate;
  },

  // "" if no comment
  getUserComment: function()
  {
    return this._UserComment || "";
  },

  setRate: function(yes, maybe, no)
  {
    this._Yes = yes;
    this._Maybe = maybe;
    this._No = no;
  },

  setUserRate: function(rate, comment)
  {
    this._UserRate = rate === "" ? null : rate;
    this._UserComment = comment === "" ? null : comment;
  }

}

