<?php

namespace App\Models;

use App\Libs\Database\Eloquent\ContentTypeModel;
use App\Models\GenericBackoffice\Traits\LanguageSupportTrait;
use App\Traits\ThrowsIndexation;

class Tag extends ContentTypeModel
{
    use LanguageSupportTrait;
    use ThrowsIndexation;

    protected $hidden = ['languages', "websites"];
    protected $with = ['languages', "websites"];

    protected $dates = []; // dates
    protected $casts = [];


    /**
     * Get all of the artists that are assigned this tag.
     */
    public function artists()
    {
        return $this->morphedByMany(Artist::class, 'taggable');
    }

    /**
     * Get all of the exhibitions that are assigned this tag.
     */
    public function exhibitions()
    {
        return $this->morphedByMany(Exhibition::class, 'taggable');
    }

    /**
     * Get all of the locations that are assigned this tag.
     */
    public function locations()
    {
        return $this->morphedByMany(Location::class, 'taggable');
    }

    /**
     * Gets the possible types
     */
    public static function getTypes(): array
    {
        return [
            'rpac' => 'RPAC'
        ];
    }
}
