/**
 * Configuration for the project structure.
 * @module ci.config.structureConfig.
 * @author Taka Okunishi
 *
 */

var util = require('util'),
    helpers = require('../helpers'),
    f = helpers.fileConfigHelper;

var meta = require('./meta-config');

exports = module.exports = {
    app: {

    },
    doc: {
        'index.html': f.newDocIndexHtmlFile({name: meta.name}),
        apiguide: {}
    },
    lib: {
        array: {},
        file: {},
        log: {},
        string: {},
        object: {},
        env: {}
    },
    ci: {
        bin: {
            build: f.newTaskBinFile({taskName: 'build'}).mode('755').force(false),
            doc: f.newTaskBinFile({taskName: 'doc'}).mode('755').force(false),
            install: f.newTaskBinFile({taskName: 'install'}).mode('755').force(false),
            release: f.newReleaseBinFile().mode('555').force(true),
            scaffold: f.newTaskBinFile({taskName: 'scaffold'}).mode('755').force(false),
            test: f.newTaskBinFile({taskName: 'test'}).mode('755').force(false)
        },
        config: {
            'dependencies-config.js': f.newCiDependenciesConfigJsFile({}).mode('644').force(false),
            'index-config.js': f.newCiIndexConfigJsFile({}).mode('644').force(false),
            'meta-config.js': f.newCiMetaConfigJsFile({}).mode('644').force(false),
            'scaffold-config.js': f.newCiScaffoldConfigJsFile({}).mode('644').force(false),
            'structure-config.js': f.newCiStructureConfigJsFile({}).mode('644').force(false)
        },
        helpers: {
            '_config_objects.js': f.newCiHelperConfigObjectsJsFile({}),
            'file_read_helper.js': f.newCiFileReadHelperJsFile({})
        },
        worker: {
            '_debug.js': f.newCiDebugJsFile({}).force(false).mode('644')
        },
        tasks: {}
    },
    tmpl: {
        _doc: {},
        bin: {},
        html: {},
        js: {},
        md: {}
    },
    test: {
        mock: {
            mock_files: {
                'mock_coffee.coffee': f.newMockCoffeeCoffeeFile({}).mode('644').force(false),
                'mock_css.css': f.newMockCssCssFile({}).mode('644').force(false),
                'mock_html.html': f.newMockHtmlHtmlFile({}).mode('644').force(false),
                'mock_jade.jade': f.newMockJadeJadeFile({}).mode('644').force(false),
                'mock_js.js': f.newMockJsJsFile({}).mode('644').force(false),
                'mock_less.less': f.newMockLessLessFile({}).mode('644').force(false),
                'mock_log.log': f.newMockLogLogFile({}).mode('644').force(false),
                'mock_txt.txt': f.newMockTxtTxtFile({}).mode('644').force(false)
            },
            mock_module: {
                'index.js': f.newIndexJsFile({}).mode('644').force(false)
            }
        },
        unit_tests: {
            get lib() {
                var result = {};
                var libModuleNames = Object.keys(exports.lib);
                libModuleNames.forEach(function (name) {
                    result[name] = {};
                });
                result['lib_index_test.js'] = f.newLibIndexTestJsFile({
                    get names() {
                        return Object.keys(exports.lib).filter(function (filename) {
                            return !filename.match(/^__/);
                        });
                    },
                    libPath: '../../../lib'
                });
                return result;
            },
            ci: {
                worker: {
                    '_debug_test.js': f.newCiDebugTestJsFile({}).mode('644').force(false)
                },
                helpers: {
                    '_config_objects_test.js': f.newCiHelperConfigObjectsTestJsFile({}),
                    'file_read_helper_test.js': f.newCiFileReadHelperTestJsFile({}),
                }
            }
        },
        scenario_tests: {

        },
        work: {},
        'test_resource.js': f.newTestResourceJsFile(),
        'mock_injector.js': f.newMockInjectorJsFile()
    },
    '.gitignore': f.newGitignoreFile({
        patterns: [
            '.*.bundle/**',
            '.*-data.json',
            'var/**/*.*',
            '.coveralls.yml',
            'test/work/*',
            'work/*'
        ]
    }),
    LICENSE: f.newLICENSEFile({
        year: new Date().getFullYear()
    }),
    'README.md': f.newREADMEMdFile().force(false).mode('644'),
    'VERSION': f.newVERSIONFile().force(false).mode('644')
};
