<?php

namespace Tests\Feature\Api;

use Tests\TestCase;

class PublicEndpointsTest extends TestCase
{
    public function test_branches_endpoint_does_not_require_auth(): void
    {
        $response = $this->getJson('/api/v1/branches');

        // 200 if DB connected, 500 if not — key is NOT 401/403
        $this->assertNotEquals(401, $response->status());
        $this->assertNotEquals(403, $response->status());
    }

    public function test_academy_news_does_not_require_auth(): void
    {
        $response = $this->getJson('/api/v1/academy/news');

        $this->assertNotEquals(401, $response->status());
        $this->assertNotEquals(403, $response->status());
    }

    public function test_academy_programs_does_not_require_auth(): void
    {
        $response = $this->getJson('/api/v1/academy/programs');

        $this->assertNotEquals(401, $response->status());
        $this->assertNotEquals(403, $response->status());
    }

    public function test_academy_events_does_not_require_auth(): void
    {
        $response = $this->getJson('/api/v1/academy/events');

        $this->assertNotEquals(401, $response->status());
        $this->assertNotEquals(403, $response->status());
    }

    public function test_academy_gallery_does_not_require_auth(): void
    {
        $response = $this->getJson('/api/v1/academy/gallery');

        $this->assertNotEquals(401, $response->status());
        $this->assertNotEquals(403, $response->status());
    }

    public function test_payment_callback_does_not_require_auth(): void
    {
        $response = $this->postJson('/api/v1/payments/callback', [
            'obj' => ['order' => null],
        ]);

        $this->assertNotEquals(401, $response->status());
    }

    public function test_health_check_is_public_and_fast(): void
    {
        $response = $this->getJson('/api/v1/health');

        $response->assertOk()
            ->assertJson(['status' => 'ok']);
    }
}
