<?php

namespace App\Models\GenericBackoffice;

use App\Libs\Database\Eloquent\ContentTypeModel;
use App\Models\Block;
use App\Models\GenericBackoffice\Traits\LanguageSupportTrait;
use App\Models\MediaItem;
use Illuminate\Support\Facades\DB;

class Entry extends ContentTypeModel
{
    use LanguageSupportTrait;

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

    protected $dates = [];
    protected $spatialFields = [];

    protected $casts = [];

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

    public function blocks()
    {
        return $this->belongsToMany(Block::class, 'entry_block')->withPivot('position');
    }

    /**
     * Gets the possible content areas for the pages
     * @return array
     */
    public static function getContentAreas(): array
    {
        return [
            'politica-de-privacidade' => 'Politica de privacidade',
            'apoios'                  => 'Apoios',
            'sobre'                   => 'Sobre',
        ];
    }
}
