package com.petshop.backend.dto.sale;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import java.util.Objects;

public class SaleItemRequest {
    @NotNull(message = "Product ID is required")
    private Long prodId;

    @NotNull(message = "Quantity is required")
    @Positive(message = "Quantity must be positive")
    private Integer quantity;

    public Long getProdId() {
        return prodId;
    }

    public void setProdId(Long prodId) {
        this.prodId = prodId;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SaleItemRequest that = (SaleItemRequest) o;
        return Objects.equals(prodId, that.prodId) &&
                Objects.equals(quantity, that.quantity);
    }

    @Override
    public int hashCode() {
        return Objects.hash(prodId, quantity);
    }

    @Override
    public String toString() {
        return "SaleItemRequest{" +
                "prodId=" + prodId +
                ", quantity=" + quantity +
                '}';
    }
}
