<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class OwnerDocs extends Model
{
    use SoftDeletes;

    protected $table = 'owner_docs';

    protected $primaryKey = 'Owner_Doc_Id'; // ✅ Correct

    public $incrementing = true;

    protected $keyType = 'int';

    protected $fillable = [
        'Owner_ID',
        'DocTy_ID',
        'Doc_No',
        'Document',
        'Is_Verified',
        'Remark'
    ];

    protected $casts = [
        'Document' => 'array',
        'Is_Verified' => 'integer'
    ];

    public function owner()
    {
        return $this->belongsTo(OwnerMaster::class, 'Owner_ID', 'Owner_ID');
    }

    public function documentType()
    {
        return $this->belongsTo(DocTypeMaster::class, 'DocTy_ID', 'DocTy_ID');
    }
}
