package org.brapi.test.BrAPITestServer.config;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OpenApiResourceController {

    @GetMapping(value = "/brapi/v2/openapi.json", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<Resource> openApiDocument() {
        return ResponseEntity.ok(new ClassPathResource("static/openapi.json"));
    }
}
