//go:build integration

package suite_test

import (
	"testing"

	"github.com/ultisuite/ulti-backend/internal/integrationtest"
)

func TestDriveQuotaOptional(t *testing.T) {
	integrationtest.SkipUnlessNextcloud(t)
	h := integrationtest.RequireHarness(t)
	client, _ := integrationtest.RequireUserClient(t, h)

	resp, err := client.Get("/api/v1/drive/quota")
	integrationtest.FailIf(err, t, "drive quota")
	if resp.Status != 200 && resp.Status != 502 && resp.Status != 503 {
		t.Fatalf("status = %d, body = %s", resp.Status, string(resp.Body))
	}
}

func TestPhotosAssetsOptional(t *testing.T) {
	integrationtest.SkipUnlessImmich(t)
	h := integrationtest.RequireHarness(t)
	client, _ := integrationtest.RequireUserClient(t, h)

	resp, err := client.Get("/api/v1/photos/assets?page=1&size=1")
	integrationtest.FailIf(err, t, "photos assets")
	if resp.Status != 200 && resp.Status != 502 && resp.Status != 503 {
		t.Fatalf("status = %d, body = %s", resp.Status, string(resp.Body))
	}
}

func TestMeetRoomOptional(t *testing.T) {
	integrationtest.SkipUnlessJitsi(t)
	h := integrationtest.RequireHarness(t)
	client, _ := integrationtest.RequireUserClient(t, h)

	resp, err := client.Post("/api/v1/meet/rooms", map[string]string{
		"subject": "Integration test room",
	})
	integrationtest.FailIf(err, t, "create meet room")
	integrationtest.FailUnlessStatus(t, resp, 201)
}
