<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace App\Http\ViewComposers;

use App\Repositories\WordRepository;
use App\Repositories\AnnotationRepository;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;

/**
 * Description of ScoreboardComposer
 *
 * @author alice
 */
class StatsComposer {

    //put your code here
    protected $wordRepository;
    protected $annotationRepository;

    public function __construct(WordRepository $wordRepository, AnnotationRepository $annotationRepository) {
        $this->wordRepository = $wordRepository;
        $this->annotationRepository = $annotationRepository;
    }

    public function compose(View $view) {
//        get_users_and_annotation_counts())
        $view->with('ref_tokens', $this->wordRepository->get_number_tokens(true)['count'])
                ->with('ref_types', $this->wordRepository->get_number_types(true)['count'])
                ->with('non_ref_tokens', $this->wordRepository->get_number_tokens(false)['count'])
                ->with('non_ref_types', $this->wordRepository->get_number_types(false)['count'])
                ->with('total_tokens', $this->wordRepository->get_total_number_tokens()['count'])
                ->with('words_323', $this->wordRepository->get_words_number(323)['count'])
                ->with('types_323', $this->wordRepository->get_types_number(323)['count'])
                ->with('sentences_323', $this->wordRepository->get_sentences_number(323)['count'])
                ->with('total_annotations', $this->annotationRepository->get_total_annotations()['count'])
                ->with('total_annotations_not_reference', $this->annotationRepository->get_total_annotations_not_reference()['count'])
                ->with('total_distinct_words_annotated', $this->annotationRepository->get_total_words_annotated()['count'])
                ->with('total_phrases_non_reference', $this->annotationRepository->get_total_sentences_annotated_not_reference()['count'])
                ->with('total_types', $this->wordRepository->get_total_number_types()['count']);
    }
}
