package com.petshop.backend.dto.product;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import java.math.BigDecimal;
import java.util.Objects;

public class ProductRequest {
    @NotBlank(message = "Product name is required")
    private String prodName;

    @NotNull(message = "Category ID is required")
    private Long categoryId;

    private String prodDesc;

    @NotNull(message = "Product price is required")
    @Positive(message = "Price must be positive")
    private BigDecimal prodPrice;

    public String getProdName() {
        return prodName;
    }

    public void setProdName(String prodName) {
        this.prodName = prodName;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public String getProdDesc() {
        return prodDesc;
    }

    public void setProdDesc(String prodDesc) {
        this.prodDesc = prodDesc;
    }

    public BigDecimal getProdPrice() {
        return prodPrice;
    }

    public void setProdPrice(BigDecimal prodPrice) {
        this.prodPrice = prodPrice;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ProductRequest that = (ProductRequest) o;
        return Objects.equals(prodName, that.prodName) &&
                Objects.equals(categoryId, that.categoryId) &&
                Objects.equals(prodDesc, that.prodDesc) &&
                Objects.equals(prodPrice, that.prodPrice);
    }

    @Override
    public int hashCode() {
        return Objects.hash(prodName, categoryId, prodDesc, prodPrice);
    }

    @Override
    public String toString() {
        return "ProductRequest{" +
                "prodName='" + prodName + '\'' +
                ", categoryId=" + categoryId +
                ", prodDesc='" + prodDesc + '\'' +
                ", prodPrice=" + prodPrice +
                '}';
    }
}
