sc_require('views/items_view');
sc_require('views/prev_button');
sc_require('views/next_button');
sc_require('views/results_count');

GoogleSearch.ResultsTabView = SC.View.extend({
    
    childViews: 'resultsCountView resultsItemsScrollView prevButton nextButton'.w(),
    layout: { left: 0, right: 0, top: 0, bottom: 0 },
    
    resultsCountView: GoogleSearch.ResultsCountView.design({
        layout: {  centerX: 0, width: 670, top: 50 }
    }),
    
    resultsItemsScrollView: SC.ScrollView.design({
        classNames: ['result-items-view'],
        layout: {  centerX: 0, width: 670, top: 80, bottom: 50 },
        hasHorizontalScroller: NO,
        hasVerticalScroller: YES,
        borderStyle: SC.BORDER_NONE,
        contentView: GoogleSearch.ItemsView.design({
            layout: { top: 0, left: 0, right:0, bottom: 0, width: 670 }
        })
    }),
    
    prevButton: GoogleSearch.PrevButtonView.design({
        layout: {  centerX: -60, bottom: 10, width: 100, height: 24 },
        defaultResponder: 'GoogleSearch.ResultsTabView',
        action: 'prevButtonClick'
    }),
    
    nextButton: GoogleSearch.NextButtonView.design({
        layout: {  centerX: 60, bottom: 10, width: 100, height: 24 },
        defaultResponder: 'GoogleSearch.ResultsTabView',
        action: 'nextButtonClick'
    }),
    
    prevButtonClick: function(evt) {
        // TODO: Remove
        console.log('PrevButton Click!');
        
        GoogleSearch.get('searchController').loadPreviousResults();
    },
            
    nextButtonClick: function(evt) {
        // TODO: Remove
        console.log('NextButton Click!');
        
        GoogleSearch.get('searchController').loadNextResults();
    }
});