<?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;

class OpenPosition extends ContentTypeModel
{
    use LanguageSupportTrait;

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

    protected $dates = []; // dates

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

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

    public function openPositionPoDetails()
    {
        return $this->belongsToMany(OpenPositionDetail::class, 'open_position_op_detail')->withPivot('position');
    }

    public function openPositionPoSpecs()
    {
        return $this->belongsToMany(OpenPositionSpec::class, 'open_position_op_spec')->withPivot('position');
    }
}
