<?php

namespace App\Models;

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

class PassengerExtraServiceRequest extends Model
{
    protected $fillable = [
        'user_id',
        'passenger_extra_service_id',
        'status',
        'notes',
        'items_snapshot',
        'admin_notes',
        'contact_phone',
        'fee_snapshot',
        'subtotal_amount',
        'app_fee_amount',
        'delivery_fee_amount',
        'total_amount',
        'wheel_milestone_pending',
        'wheel_promo_fee_amount',
        'wheel_result',
        'wheel_spun_at',
        'completed_at',
    ];

    protected $casts = [
        'fee_snapshot' => 'decimal:2',
        'subtotal_amount' => 'decimal:2',
        'app_fee_amount' => 'decimal:2',
        'delivery_fee_amount' => 'decimal:2',
        'total_amount' => 'decimal:2',
        'items_snapshot' => 'array',
        'wheel_milestone_pending' => 'boolean',
        'wheel_promo_fee_amount' => 'decimal:2',
        'wheel_result' => 'integer',
        'wheel_spun_at' => 'datetime',
        'completed_at' => 'datetime',
    ];

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

    public function service(): BelongsTo
    {
        return $this->belongsTo(PassengerExtraService::class, 'passenger_extra_service_id');
    }
}
