<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class ProntoSmokeTest extends TestCase
{
    use RefreshDatabase;

    public function test_admin_login_catalog_and_customer_otp_flow_work()
    {
        $this->seed();

        $this->get('/admin/login')->assertOk();

        $this->postJson('/api/v1/admin/login', [
            'login' => 'admin@pronto.local',
            'password' => 'admin12345',
        ])->assertOk()->assertJsonPath('success', true);

        $this->getJson('/api/v1/catalog/services')
            ->assertOk()
            ->assertJsonPath('success', true);

        $this->postJson('/api/v1/auth/otp/send', [
            'phone' => '7777777777',
        ])->assertOk();

        $this->postJson('/api/v1/auth/otp/verify', [
            'phone' => '7777777777',
            'otp' => '123456',
            'name' => 'Smoke Customer',
        ])->assertOk()->assertJsonPath('success', true);
    }
}
