"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = getCourseType;

var _fs = _interopRequireDefault(require("fs"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Check is this folder contains nanodegree, course or what
 * @param {string} jsonPath path to json file
 * @returns {string} course type
 */
function getCourseType(jsonPath, filename = 'data.json') {
  const pathData = `${jsonPath}/${filename}`; // read json file for data

  let courseType;

  let data = _fs.default.readFileSync(pathData, 'utf-8');

  data = JSON.parse(data);
  ({
    data
  } = data);
  if (data.nanodegree) courseType = 'NANODEGREE';else if (data.course) courseType = 'COURSE';else courseType = 'UNKNOWN';
  return courseType;
}