var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/// <reference path="../base/BaseClass.ts" />
/// <reference path="../debug.ts" />
var econda;
(function (econda) {
    var media;
    (function (media) {
        /**
         * Content category, part of {@link econda.media.Content} definition.
         *
         *   Example:
         *
         *       //create a content object
         *       var myContent = new econda.media.Content({
         *           name: "MyMediaFile"
         *       });
         *       // add a category
         *       myContent.setCategory(new econda.media.Category({
         *             path: "/ProductViedeos"
         *       });
         *
         *       // you can use a shortcut syntax
         *       myContent.setCategory("/ProductVideos");
         *
         *       // or let's do it all in constructor of content object
         *       var myContent = new econda.media.Content({
         *           name: "MyMediaFile",
         *           category: "/ProductVideos"
         *       });
        
         * @class econda.media.Category
         * @extends econda.base.BaseClass
         */
        var Category = (function (_super) {
            __extends(Category, _super);
            function Category(cfg) {
                _super.call(this);
                /**
                 * Name or path of category (use slash to separate parts)
                 * A path must start with a slash, if you set a value that does not start
                 * with a slash, a slash will be added automatically
                 * @cfg {String} path
                 * @accessor
                 */
                this.path = null;
                this.getPath = function () {
                    return this.path;
                };
                /**
                 * Handle non object cfg values as value for property "name"
                 * @property {String} __defaultProperty
                 * @private
                 */
                this.__defaultProperty = "path";
                if (cfg instanceof Category) {
                    return cfg;
                }
                this.initConfig(cfg);
            }
            Category.prototype.setPath = function (path) {
                if (typeof path !== 'string') {
                    econda.debug.error("Category expects a String as path. Got: " + path, path);
                }
                else {
                    if (path.substr(0, 1) == '/') {
                        this.path = path.substring(1);
                    }
                    else {
                        this.path = path;
                    }
                }
                return this;
            };
            /**
             * Returns path of category as String
             * @method
             * @return {String} path of category
             */
            Category.prototype.toString = function () {
                return this.getPath();
            };
            return Category;
        }(econda.base.BaseClass));
        media.Category = Category;
    })(media = econda.media || (econda.media = {}));
})(econda || (econda = {}));