// Path: cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/command/CommandBus.java
// public interface CommandBus {
// 
//   void dispatch(Command command);
// 
//   <T extends CommandHandler> T register(T handler);
// 
// }
// 
// Path: order-context-parent/publisher-contract-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/api/RegisterPublisherContractRequest.java
// public class RegisterPublisherContractRequest extends TransportObject {
// 
//   @NotEmpty
//   @Pattern(regexp = ID_PATTERN)
//   public String publisherContractId;
// 
//   @NotNull
//   public String publisherName;
// 
//   @Min(1)
//   public double feePercentage;
// 
//   @Min(1)
//   public long limit;
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract/PublisherContractId.java
// public class PublisherContractId extends GenericId {
// 
//   public PublisherContractId(@JsonProperty("id") String id) {
//     super(id);
//   }
// 
//   public static PublisherContractId randomId() {
//     return new PublisherContractId(UUID.randomUUID().toString());
//   }
// 
// }
// 
// Path: order-context-parent/publisher-contract-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract/command/CommandFactory.java
// public class CommandFactory {
// 
//   public RegisterPublisherContractCommand toCommand(PublisherContractId contractId, RegisterPublisherContractRequest request) {
//     return new RegisterPublisherContractCommand(contractId, request.publisherName, request.feePercentage, request.limit);
//   }
// 
// }
// 
// Path: order-context-parent/publisher-contract-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract/command/RegisterPublisherContractCommand.java
// public class RegisterPublisherContractCommand extends Command {
// 
//   public final PublisherContractId publisherContractId;
//   public final String publisherName;
//   public final double feePercentage;
//   public final long limit;
// 
//   public RegisterPublisherContractCommand(PublisherContractId publisherContractId, String publisherName, double feePercentage, long limit) {
//     checkArgument(publisherContractId != null, "PublisherContractId cannot be null");
//     checkArgument(publisherName != null, "PublisherName cannot be null");
//     checkArgument(feePercentage > 0, "Fee must be a positive number");
//     checkArgument(limit > 0, "Limit must be a positive number");
// 
//     this.publisherContractId = publisherContractId;
//     this.publisherName = publisherName;
//     this.feePercentage = feePercentage;
//     this.limit = limit;
//   }
// 
// }


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import se.citerus.cqrs.bookstore.command.CommandBus;
import se.citerus.cqrs.bookstore.ordercontext.api.RegisterPublisherContractRequest;
import se.citerus.cqrs.bookstore.ordercontext.publishercontract.PublisherContractId;
import se.citerus.cqrs.bookstore.ordercontext.publishercontract.command.CommandFactory;
import se.citerus.cqrs.bookstore.ordercontext.publishercontract.command.RegisterPublisherContractCommand;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
package se.citerus.cqrs.bookstore.ordercontext.resource;




@Path("publisher-contract-requests")
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
public class PublisherContractResource {

  private final Logger logger = LoggerFactory.getLogger(getClass());
  private final CommandBus commandBus;
// Path: cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/command/CommandBus.java
// public interface CommandBus {
// 
//   void dispatch(Command command);
// 
//   <T extends CommandHandler> T register(T handler);
// 
// }
// 
// Path: order-context-parent/publisher-contract-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/api/RegisterPublisherContractRequest.java
// public class RegisterPublisherContractRequest extends TransportObject {
// 
//   @NotEmpty
//   @Pattern(regexp = ID_PATTERN)
//   public String publisherContractId;
// 
//   @NotNull
//   public String publisherName;
// 
//   @Min(1)
//   public double feePercentage;
// 
//   @Min(1)
//   public long limit;
// 
// }
// 
// Path: order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract/PublisherContractId.java
// public class PublisherContractId extends GenericId {
// 
//   public PublisherContractId(@JsonProperty("id") String id) {
//     super(id);
//   }
// 
//   public static PublisherContractId randomId() {
//     return new PublisherContractId(UUID.randomUUID().toString());
//   }
// 
// }
// 
// Path: order-context-parent/publisher-contract-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract/command/CommandFactory.java
// public class CommandFactory {
// 
//   public RegisterPublisherContractCommand toCommand(PublisherContractId contractId, RegisterPublisherContractRequest request) {
//     return new RegisterPublisherContractCommand(contractId, request.publisherName, request.feePercentage, request.limit);
//   }
// 
// }
// 
// Path: order-context-parent/publisher-contract-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract/command/RegisterPublisherContractCommand.java
// public class RegisterPublisherContractCommand extends Command {
// 
//   public final PublisherContractId publisherContractId;
//   public final String publisherName;
//   public final double feePercentage;
//   public final long limit;
// 
//   public RegisterPublisherContractCommand(PublisherContractId publisherContractId, String publisherName, double feePercentage, long limit) {
//     checkArgument(publisherContractId != null, "PublisherContractId cannot be null");
//     checkArgument(publisherName != null, "PublisherName cannot be null");
//     checkArgument(feePercentage > 0, "Fee must be a positive number");
//     checkArgument(limit > 0, "Limit must be a positive number");
// 
//     this.publisherContractId = publisherContractId;
//     this.publisherName = publisherName;
//     this.feePercentage = feePercentage;
//     this.limit = limit;
//   }
// 
// }


// Path: order-context-parent/publisher-contract-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/resource/PublisherContractResource.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import se.citerus.cqrs.bookstore.command.CommandBus;
import se.citerus.cqrs.bookstore.ordercontext.api.RegisterPublisherContractRequest;
import se.citerus.cqrs.bookstore.ordercontext.publishercontract.PublisherContractId;
import se.citerus.cqrs.bookstore.ordercontext.publishercontract.command.CommandFactory;
import se.citerus.cqrs.bookstore.ordercontext.publishercontract.command.RegisterPublisherContractCommand;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;

package se.citerus.cqrs.bookstore.ordercontext.resource;




@Path("publisher-contract-requests")
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
public class PublisherContractResource {

  private final Logger logger = LoggerFactory.getLogger(getClass());
  private final CommandBus commandBus;
  private final CommandFactory commandFactory = new CommandFactory();