<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use \DateTimeInterface;

class Shop extends Model
{
    use HasFactory;

    protected $fillable = [
        'user_id',
        'floor_id',
        'business_type_id',
        'service_charge_id',
        'shop_owner_id',
        'shop_keeper_id',
        'shop_name',
        'shop_no',
        'shop_size',
        'shop_description',
        'status',
    ];

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('d-m-Y H:i:s');
    }

    public function userData()
    {
        return $this->belongsTo(User::class,'user_id');
    }
   
    public function floorData()
    {
        return $this->belongsTo(Floor::class,'floor_id');
    }
    
    public function businessTypeData()
    {
        return $this->belongsTo(BusinessType::class,'business_type_id');
    }
    
    public function serviceChargeData()
    {
        return $this->belongsTo(ServiceCharge::class,'service_charge_id');
    }

    public function shopOwnerData()
    {
        return $this->belongsTo(User::class,'shop_owner_id');
    }
    
    public function shopKeeperData()
    {
        return $this->belongsTo(User::class,'shop_keeper_id');
    }
}
