package serwisy;

import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;

import java.util.List;

@Path("/student")
public class StudentRest {

    @Produces(MediaType.APPLICATION_JSON)
    @GET
    public Student getStudent() {
        Student student = new Student("Jan", "Kowalski", List.of(4, 5, 4, 3));
        return student;
    }

    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    @Produces(MediaType.TEXT_HTML)
    @POST
    public String postStudent(Student student) {
        return "<html><body><h1>Dane studenta</h1>"
                + "<p>Imię: " + student.getImie() + "</p>"
                + "<p>Nazwisko: " + student.getNazwisko() + "</p>"
                + "</body></html>";
    }
}
