/**
 * Config object.
 * @module task.helpers._configObjects
 * @author "ci.worker.generateStructure"
 * @protected
 */

var lib = require('../../lib'),
    object = lib.object;

/**
 * Define a chainable object.
 * @param {object} defaultValues - Default values.
 * @param {string[]} properties - Properties.
 * @returns {object}
 * @protected
 */
function defineChainable(defaultValues, properties) {
    if (!defaultValues)defaultValues = {};
    return object.defineStrict({
        init: function () {
            var s = this;
            Object.keys(defaultValues).forEach(function (key) {
                var val = defaultValues[key];
                s[key] = (val);
            });
            s.__serializable = true;
        },
        accessor: properties,
        properties: {
        }
    });
}


/**
 * Object to represent a file for apemanfile configuration.
 * @constructor task.helpers._configObjects.File
 */
exports.File = defineChainable({
    _type: 'file'
}, [
    'tmpl', 'data', 'force', 'mode'
]);


exports._defineChainable = defineChainable;