<?php

namespace App\Models;

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

class Complaint extends Model
{
    use HasFactory;

    protected $table = 'tbl_complaint';
    protected $guarded = array();

    protected $casts = [
        'id' => 'integer',
        'user_id' => 'integer',
        'department_id' => 'integer',
        'service_id' => 'integer',
        'sub_in_charge_id' => 'integer',
        'hashtag_id' => 'string',
        'complaint_info' => 'string',
        'complaint_reply' => 'string',
        'address' => 'string',
        'area' => 'string',
        'city' => 'string',
        'state' => 'string',
        'country' => 'string',
        'pincode' => 'string',
        'latitude' => 'string',
        'longitude' => 'string',
        'total_like' => 'integer',
        'total_dislike' => 'integer',
        'status' => 'integer',
    ];

    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }
    public function department()
    {
        return $this->belongsTo(Department::class, 'department_id');
    }
    public function service()
    {
        return $this->belongsTo(Service::class, 'service_id');
    }
    public function sub_in_charge()
    {
        return $this->belongsTo(Sub_In_Charge::class, 'sub_in_charge_id');
    }
}
