<?php

namespace App\Models\Chats;

use App\Models\User;
use App\Support\UuidScopeTrait;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;

class Message extends Model {
    use UuidScopeTrait, SoftDeletes;

    protected $dates = [
        'read_at'
    ];

    protected $fillable = [
        'uuid',
        'chat_id',
        'manager_id',
        'client_id',
        'content',
        'read_at'
    ];

    protected $hidden = [
        'id'
    ];


    public function chat(): BelongsTo {
        return $this->belongsTo(Chat::class);
    }

    public function manager(): BelongsTo {
        return $this->belongsTo(User::class);
    }

    public function client(): BelongsTo {
        return $this->belongsTo(Client::class);
    }

}
