<?php

    namespace App\Models;

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

    class Block extends ContentTypeModel
    {
        use LanguageSupportTrait;

        const STORYTELLING_TYPE_OLISIPO = 'olisipo';
        const STORYTELLING_TYPE_OLD_WORLD = 'old_world';

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

        public function imageLegend() {
            return $this->belongsToMany(ImageLegend::class)->withPivot('position')->withTimestamps();
        }

        public function backgroundImage() {
            return $this->belongsTo(MediaItem::class);
        }

        public function videos() {
            return $this->belongsToMany(Video::class)->withPivot('position')->withTimestamps();
        }
    }
