<?php

namespace app\models;
use yii\mongodb\ActiveRecord;

class Report extends ActiveRecord
{
    public static function collectionName() {
        return 'reports';
    }

    // selectedFields represent the selected fields groupped by the form
    // selectedFieldsOrder represent the selected fields ordered by user
    public function attributes() {
        return ['_id', 'name', 'description', 'dataSource', 'selectedFields', 'selectedFieldsOrder',
            'filters', 'sort', 'calculations', 'grouping', 'createdAt', 'updatedAt', 'status'];
    }

    public function rules(){
        return [
            [['name', 'createdAt'], 'required'],
            [['dataSource', 'filters', 'sort'], 'safe'],
        ];
    }
}
