<?php

use App\Enums\ConsultationStatus;
use App\Enums\ConsultationType;
use App\Enums\PaymentStatus;
use App\Models\Consultation;
use App\Models\User;

test('consultation has correct consultation type cast', function () {
    $consultation = Consultation::factory()->create(['consultation_type' => 'free']);

    expect($consultation->consultation_type)->toBeInstanceOf(ConsultationType::class)
        ->and($consultation->consultation_type)->toBe(ConsultationType::Free);
});

test('consultation has correct status cast', function () {
    $consultation = Consultation::factory()->create(['status' => 'pending']);

    expect($consultation->status)->toBeInstanceOf(ConsultationStatus::class)
        ->and($consultation->status)->toBe(ConsultationStatus::Pending);
});

test('consultation has correct payment status cast', function () {
    $consultation = Consultation::factory()->create(['payment_status' => 'na']);

    expect($consultation->payment_status)->toBeInstanceOf(PaymentStatus::class)
        ->and($consultation->payment_status)->toBe(PaymentStatus::NotApplicable);
});

test('consultation belongs to user', function () {
    $user = User::factory()->create();
    $consultation = Consultation::factory()->create(['user_id' => $user->id]);

    expect($consultation->user)->toBeInstanceOf(User::class)
        ->and($consultation->user->id)->toBe($user->id);
});

test('consultation has booking date cast as date', function () {
    $consultation = Consultation::factory()->create();

    expect($consultation->booking_date)->toBeInstanceOf(\Illuminate\Support\Carbon::class);
});
