StoreRequest.java

package com.fulfilment.application.monolith.stores.dto;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;

/** Inbound DTO for create and update store requests. */
public class StoreRequest {

  /**
   * Client must not supply an ID — IDs are assigned by the server.
   * Checked explicitly in the create endpoint.
   */
  public Long id;

  @Size(min = 2, max = 40, message = "Store name must be between 2 and 40 characters")
  @Pattern(
      regexp = "^[\\p{L}\\p{N} _\\-]+$",
      message = "Store name may only contain letters, digits, spaces, hyphens, and underscores")
  public String name;

  @Min(value = 0, message = "Quantity in stock cannot be negative")
  @Max(value = 1_000_000, message = "Quantity in stock cannot exceed 1,000,000")
  public int quantityProductsInStock;
}