<?php

namespace App\Models;

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

class Add extends ContentTypeModel
{
    use LanguageSupportTrait;

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

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

    public function image()
    {
        return $this->belongsTo(MediaItem::class, 'image_id');
    }

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

    public function getDisplayDurationAttribute()
    {
        return !empty($this->display_duration) ? $this->display_duration : 5;
    }
}
