<?php

namespace App\Models\Tenants;

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

class AiVoiceRecording extends Model
{
    use SoftDeletes;

    protected $table = 'ai_voice_recordings';

    protected $fillable = [
        'tenant_id',
        'user_id',
        'title',
        'interview_template_id',
        'audio_file_path',
        'audio_gcs_uri',
        'transcript_text',
        'analysis_text',
        'status',
        'duration_seconds',
        'file_expiry_date',
    ];

    protected $casts = [
        'duration_seconds' => 'integer',
        'file_expiry_date' => 'datetime',
    ];

    public const STATUS_PENDING = 'PENDING';

    public const STATUS_PROCESSING = 'PROCESSING';

    public const STATUS_COMPLETED = 'COMPLETED';

    public const STATUS_FAILED = 'FAILED';

    public function user(): BelongsTo
    {
        return $this->belongsTo(\App\Models\Members\User::class);
    }
}
