"use strict";

var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };

var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };

var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

var Declaration = _interopRequire(require("./declaration"));

var Container = _interopRequire(require("./container"));

var list = _interopRequire(require("./list"));

// CSS rule like “a { }”

var Rule = (function (Container) {
    function Rule(defaults) {
        _classCallCheck(this, Rule);

        this.type = "rule";
        this.nodes = [];
        Container.call(this, defaults);
    }

    _inherits(Rule, Container);

    // Stringify rule

    Rule.prototype.stringify = function stringify(builder) {
        this.stringifyBlock(builder, this.stringifyRaw("selector"));
    };

    _prototypeProperties(Rule, null, {
        selectors: {

            // Shortcut to get selectors as array

            get: function () {
                return list.comma(this.selector);
            },
            set: function (values) {
                this.selector = values.join(", ");
            },
            configurable: true
        }
    });

    return Rule;
})(Container);

module.exports = Rule;