package com.example.api;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/api/orders")
public class OrderController {
@GetMapping("/{id}")
public ResponseEntity<Map<String, Object>> getOrder(@PathVariable Long id) {
return ResponseEntity.ok(Map.of(
"orderId", id,
"status", "CONFIRMED",
"runtime", "OnlineAIIDE Spring Boot Sandbox"
));
}
@PostMapping
public ResponseEntity<Map<String, Object>> createOrder(@RequestBody Map<String, Object> payload) {
return ResponseEntity.ok(Map.of(
"message", "Order processed successfully",
"details", payload
));
}
}