'use strict';

/* eslint no-unused-vars: 0 */

// TODO: handle proper validation of the path and resource
function handleValidation( path, resource ) {
    let retval = true;

    if ( path === '' ) {
        retval = 'INVALID_RESOURCE_PATH';
    } else if ( resource === '' ) {
        retval = 'INVALID_RESOURCE';
    }

    return retval;
}

module.exports.get = function get( path, resource ) {
    const isValid = handleValidation( path, resource );

    if ( isValid !== true ) {
        return Promise.resolve({ status: isValid });
    }

    return Promise.resolve({});
};

module.exports.search = function search( path, resource, query, sorting, recursive ) {
    const isValid = handleValidation( path, resource );

    if ( isValid !== true ) {
        return Promise.resolve({ status: isValid });
    }

    return Promise.resolve({});
};

module.exports.inspect = function inspect( path, resource, fields ) {
    const isValid = handleValidation( path, resource );

    if ( isValid !== true ) {
        return Promise.resolve({ status: isValid });
    }

    return Promise.resolve({});
};

module.exports.download = function handleDownload( path, resource ) {
    const isValid = handleValidation( path, resource );

    if ( isValid !== true ) {
        return Promise.resolve({ status: isValid });
    }

    return Promise.resolve({});
};

'use strict';

/* eslint no-unused-vars: 0 */

module.exports.read = function read( fullPath ) {
    // TODO: Hit w3 bucket and retrieve

    return Promise.resolve({ status: 'not yet implemented' });
};

module.exports.search = function search( fullPath, data ) {
    // TODO: Hit mongo and retrieve folder contents

    return Promise.resolve({ status: 'not yet implemented' });
};

module.exports.inspect = function inspect( fullPath, data ) {
    // TODO: Hit mongo and retrieve metadata for the resource

    return Promise.resolve({ status: 'not yet implemented' });
};

module.exports.download = function handleDownload( fullPath ) {
    // TODO: Hit w3 bucket and retrieve, then compress

    return Promise.resolve({ status: 'not yet implemented' });
};

Break out general validation from modules
Break out general validation from  modules

Request formatting and existence validation will be done in a top
level routing file (not yet implemented). This leaves the modules
to simply implement their specific cases, and handle action-specific
validation.
