<?php

class EventItem extends ContentTypeModel{
    use LanguageSupportTrait;
    
    const TYPE_IMAGE    = "image";
    const TYPE_VIDEO    = "video";
    const TYPE_AUDIO    = "audio";
    const TYPE_TEXT     = "text";
    
    protected $dates = array("start_date");
    
    protected $hidden = array('languages', "websites");
    protected $with = array("languages", "websites");
    
    public function locations(){
        return $this->belongsToMany("Location");
    }
    
    public function area(){
        return $this->belongsTo("Area");
    }
    
    public function keywords(){
        return $this->belongsToMany("Keyword");
    }
    
    public function persons(){
        return $this->belongsToMany("Person");
    }

    public function eventMedias(){
        return $this->hasMany("EventMedia");
    }

    public function image(){
        return $this->belongsTo("MediaItem");
    }
    
    public function eventDates(){
        return $this->hasMany("EventDate");
    }
    
    public function isImage(){
        return $this->event_type == self::TYPE_IMAGE;
    }
    
    public function isVideo(){
        return $this->event_type == self::TYPE_VIDEO;
    }
    
    public function isAudio(){
        return $this->event_type == self::TYPE_AUDIO;
    }
    
    public function isText(){
        return $this->event_type == self::TYPE_TEXT;
    }
}