<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class BiataBotMessage extends Model
{
    protected $fillable = [
        'conversation_id',
        'role',
        'content',
    ];

    public function conversation(): BelongsTo
    {
        return $this->belongsTo(BiataBotConversation::class, 'conversation_id');
    }

    public function shamsiCreatedAt(): string
    {
        return Order::toJalaliString($this->created_at)
            . ' ' . $this->created_at->format('H:i');
    }
}
