
package com.tmerclub.cloud.api.product.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author tmerclub
 * @date 2020/12/22
 */
@Data
public class SkuStockLockDTO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    @NotNull(message = "产品ID不能为空")
    @Schema(description = "产品ID", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long spuId;

    @NotNull(message = "skuId不能为空")
    @Schema(description = "skuId", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long skuId;

    @NotNull(message = "shopId不能为空")
    @Schema(description = "shopId", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long shopId;

    @NotNull(message = "orderId不能为空")
    @Schema(description = "orderId", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long orderId;

    @NotNull(message = "商品数量不能为空")
    @Min(value = 1, message = "商品数量不能为空")
    @Schema(description = "商品数量", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer count;

    @Schema(description = "仓库id")
    private Long warehouseId;

    public SkuStockLockDTO() {
    }

    public SkuStockLockDTO(Long skuId, Long orderId, Integer count) {
        this.skuId = skuId;
        this.orderId = orderId;
        this.count = count;
    }

    public SkuStockLockDTO(Long orderId, Long warehouseId, Long skuId, Integer count) {
        this.skuId = skuId;
        this.orderId = orderId;
        this.count = count;
        this.warehouseId = warehouseId;
    }

    public SkuStockLockDTO(Long shopId, Long spuId, Long skuId, Long orderId, Integer count) {
        this.shopId = shopId;
        this.spuId = spuId;
        this.skuId = skuId;
        this.orderId = orderId;
        this.count = count;
    }

    @Override
    public String toString() {
        return "SkuStockLockDTO{" +
                "spuId=" + spuId +
                ", skuId=" + skuId +
                ", shopId=" + shopId +
                ", orderId=" + orderId +
                ", count=" + count +
                '}';
    }
}
