package de.assecutor.hha.backend.api;

import java.time.Instant;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class StatusController {

    @GetMapping("/status")
    public BackendStatus status() {
        return new BackendStatus(
                "hha-backend",
                "UP",
                "HHA Backoffice",
                "Vaadin UI und REST API verfuegbar",
                List.of("app", "backend", "vaadin-ui"),
                Instant.now(),
                Runtime.version().toString()
        );
    }

    public record BackendStatus(
            String application,
            String status,
            String ui,
            String message,
            List<String> modules,
            Instant timestamp,
            String javaVersion
    ) {
    }
}
