package de.thpeetz.kontor.comics;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import de.thpeetz.kontor.comics.service.ArtistService;
import de.thpeetz.kontor.comics.service.ComicsService;
import de.thpeetz.kontor.comics.service.PublisherService;

@Path("/kontor/comics")
public class ComicsResource {

    @Inject
    transient ComicsService comicsService;
    
    @Inject
    transient ArtistService artistService;
    
    @Inject
    transient PublisherService publisherService;

    @GET
    @Produces(MediaType.TEXT_HTML)
    @Path("/")
    public String showComicList() {
        return comicsService.showComicList();
    }

    @GET
    @Produces(MediaType.TEXT_HTML)
    @Path("/artist")
    public String showArtistList() {
        return artistService.showArtistList();
    }

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/artist")
    public String showArtistListJson() {
        return artistService.showArtistList();
    }

    @GET
    @Produces(MediaType.TEXT_HTML)
    @Path("/artist/view/{artist_id}")
    public String showArtist(String artist_id) {
        return artistService.showArtist(artist_id);
    }

    @GET
    @Produces(MediaType.TEXT_HTML)
    @Path("/artist/create")
    public String showArtistCreation() {
        return artistService.showArtistCreation();
    }

    @POST
    @Produces(MediaType.TEXT_HTML)
    @Path("/artist/create")
    public String validateArtistDetails() {
        return artistService.validateArtistDetails();
    }

    @GET
    @Produces(MediaType.TEXT_HTML)
    @Path("/publisher")
    public String showPublisherList() {
        return publisherService.showPublisherList();
    }

    @GET
    @Produces(MediaType.TEXT_HTML)
    @Path("/publisher/view/{publisher_id}")
    public String showPublisher(String publisher_id) {
        return publisherService.showPublisher(publisher_id);
    }

    @GET
    @Produces(MediaType.TEXT_HTML)
    @Path("/publisher/create")
    public String showPublisherCreation() {
        return publisherService.showPublisherCreation();
    }

    @POST
    @Produces(MediaType.TEXT_HTML)
    @Path("/publisher/create")
    public String validatePublisherDetails() {
        return publisherService.validatePublisherDetails();
    }
}
