<?php

namespace App\Models\ItemMaster;

use App\Traits\Auditable;
use App\Traits\BelongsToTenant;
use App\Traits\ModelTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class CustomTab extends Model
{
    use Auditable, BelongsToTenant, ModelTrait, SoftDeletes;

    protected $fillable = [
        'tenant_id',
        'label',
        'icon',
        'is_default',
        'order_no',
        'created_by',
        'updated_by',
        'deleted_by',
    ];

    protected $casts = [
        'is_default' => 'boolean',
        'order_no' => 'integer',
        'created_at' => 'datetime',
        'updated_at' => 'datetime',
        'deleted_at' => 'datetime',
    ];

    protected $hidden = [
        'deleted_by',
        'deleted_at',
    ];

    /**
     * 탭의 컬럼 설정
     */
    public function columnSetting()
    {
        return $this->hasOne(TabColumn::class, 'tab_id');
    }
}
