"use strict";
var Future = require("fibers/future");
var path = require("path");
var Project = (function () {
    function Project($cordovaProjectCapabilities, $fs, $logger, $nativeScriptProjectCapabilities, $projectConstants) {
        this.$cordovaProjectCapabilities = $cordovaProjectCapabilities;
        this.$fs = $fs;
        this.$logger = $logger;
        this.$nativeScriptProjectCapabilities = $nativeScriptProjectCapabilities;
        this.$projectConstants = $projectConstants;
    }
    Project.prototype.getProjectDir = function () {
        return Future.fromResult(this.projectDir);
    };
    Object.defineProperty(Project.prototype, "projectData", {
        get: function () {
            if (this.projectDir) {
                var projectFile = path.join(this.projectDir, this.$projectConstants.PROJECT_FILE);
                var jsonContent = this.$fs.readJson(projectFile).wait();
                this.$logger.trace("Project data is: ", jsonContent);
                return jsonContent;
            }
            return null;
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(Project.prototype, "capabilities", {
        get: function () {
            var projectData = this.projectData;
            if (projectData) {
                if (projectData.Framework && projectData.Framework.toLowerCase() === this.$projectConstants.TARGET_FRAMEWORK_IDENTIFIERS.NativeScript.toLowerCase()) {
                    return this.$nativeScriptProjectCapabilities;
                }
                else if (projectData.Framework && projectData.Framework.toLowerCase() === this.$projectConstants.TARGET_FRAMEWORK_IDENTIFIERS.Cordova.toLowerCase()) {
                    return this.$cordovaProjectCapabilities;
                }
            }
            return null;
        },
        enumerable: true,
        configurable: true
    });
    return Project;
})();
exports.Project = Project;
$injector.register("project", Project);
