text: const CustomError = require("../extensions/custom-error");
  /*
  class VigenereCipheringMachine {
    encrypt() {
      throw new CustomError('Not implemented');
      // remove line with error and write your code here
    }    
    decrypt() {
      throw new CustomError('Not implemented');
      // remove line with error and write your code here
    }
  }
  */
  
  class VigenereCipheringMachine {
    constructor (machine) { 
      this.machine = machine; //true/nothing - direct, false - revers
    }
  
    encrypt (message, key) {
    if (typeof message === "underfined" && typeof key === "underfined") {
      console.log(this.mashine);
      //console.log(message);
      let encryptedMessage = '';
      if (this.mashine==false) encryptedMessage= String(message).toUpperCase().split('').reverse().join('');
      else encryptedMessage = String(message).toUpperCase();
    }
    else {  
      throw new Error();     
    }
    //console.log(encryptedMessage);
    return encryptedMessage;
  }
    decrypt (encryptedMessage, key) {
      if (typeof encryptedMessage  === "underfined" && typeof key === "underfined")   {
        //console.log(encryptedMessage);  
        let decryptedMessage = '';
        if (this.mashine==false) decryptedMessage=String(encryptedMessage).toUpperCase.split('').reverse().join('');
        else decryptedMessage = String(encryptedMessage).toUpperCase();
      }
      else {  
        throw new Error();     
      }
      //console.log(decryptedMessage);
      return decryptedMessage;
    }
    
    }
  
  module.exports = VigenereCipheringMachine;
  