//TOOLS
import DataUtils, {
    REQUEST_TYPE_GET,
    REQUEST_TYPE_PUT,
    REQUEST_TYPE_POST,
    REQUEST_TYPE_DELETE,
    CONTENT_TYPE_JSON,
    CONTENT_TYPE_FORM
} from '../tools/utilities/DataUtils.jsx';
import * as DataEvent from '../tools/events/DataEvent.jsx';
import Animate from '../tools/effects/Animate.jsx';
import * as Ease from '../tools/effects/Animate.jsx';
import TextEffects from '../tools/effects/TextEffects.jsx';
//Client-side Pages
import DisplayIndex from './DisplayIndex.jsx';
import DisplayWork from './DisplayWork.jsx';
import DisplayBlog from './DisplayBlog.jsx';
import DisplayFi from './DisplayFi.jsx';

class DisplayClient {
    //--------------------------
    // constructor
    //--------------------------
    constructor(section, page) {
        this.section = section;
        this.page = page;
        this.current = null;
        this.start();
    }
    //--------------------------
    // methods
    //--------------------------
    start() {
        let self = this;
        new Animate().object({
            targets: document.getElementById('loader'),
            duration: 300,
            opacity: 0,
            easing: 'easeInOutQuad',
            complete: function () {
                document.getElementById('loader').style.display = 'none';
                document.getElementById('loader').style.visibility = 'hidden';
                new Animate().object({
                    targets: document.getElementById('header'),
                    duration: 10,
                    opacity: 1,
                    easing: 'easeInOutQuad',
                    complete: function () {
                        new TextEffects().scramble(document.getElementById('the-title'), 50, function () {
                            switch(self.section){
                                case "blog":
                                    self.current = new DisplayBlog();
                                    break
                                case "work":
                                    self.current = new DisplayWork();
                                    break
                                case "fipamo":
                                    self.current = new DisplayFi();
                                    break
                                default:
                                    self.current = new DisplayIndex();
                                    break
                            }
                            
                        });
                    }
                });
            }
        });
    }
    //--------------------------
    // event handlers
    //--------------------------

}
export {
    DisplayClient as
    default
}