<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class KycDocument extends Model
{
    protected $fillable = [
        'user_id', 'type', 'file_path', 'original_name',
        'status', 'rejection_reason', 'verified_by', 'verified_at', 'expires_at',
    ];
    protected $casts = ['verified_at' => 'datetime', 'expires_at' => 'datetime'];

    const TYPES = [
        'id_card'          => 'Government ID',
        'passport'         => 'Passport',
        'drivers_license'  => "Driver's License",
        'proof_of_address' => 'Proof of Address',
        'selfie'           => 'Selfie / Face Photo',
        'bank_statement'   => 'Bank Statement',
    ];

    const STATUSES = ['pending', 'under_review', 'approved', 'rejected', 'expired'];

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

    public function getTypeLabel(): string
    {
        return static::TYPES[$this->type] ?? ucfirst($this->type);
    }
}
