package com.yc.ship.module.product.controller.admin.productSpu.groupVO;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.math.RoundingMode;

@Schema(description = "管理后台 - 产品组合新增/修改 Request VO")
@Data
public class ProductGroupSaveReqVO {

    @Schema(description = "主键", example = "21229")
    private Long id;

    @Schema(description = "产品ID", example = "23709")
    private Long productId;

    @Schema(description = "基础产品ID;平台产品时为关联ID", example = "8989")
//    @NotNull(message = "基础产品ID不能为空")
    private Long productBaseId;

    @Schema(description = "基础产品类型;0自建子票 1平台产品", example = "1")
    private Integer productBaseType = 0;

    @Schema(description = "sku_id", example = "28152")
    private Long skuId;

    @Schema(description = "项目ID", example = "11824")
    @NotNull(message = "项目ID不能为空")
    private Long projectId;

    @Schema(description = "优先资源ID", example = "11824")
    @NotNull(message = "优先资源ID不能为空")
    private Long firstResourceId;

    @Schema(description = "规格ID", example = "7216")
    private Long specificationId;

    @Schema(description = "成本价格", example = "14190")
    private BigDecimal costPrice;

    @Schema(description = "销售价格", example = "27592")
    private BigDecimal salePrice;

    @Schema(description = "规格类型：common通用 full全价 half半价 free免票", example = "1")
    private String specType;

    @Schema(description = "是否必选;0否 1是")
    private Integer needChoose;

    @Schema(description = "非必选项目最大选择数量")
    private Integer maxNum;

    @Schema(description = "第几天")
    private Integer daySort;

    @Schema(description = "是否匹配过")
    private Boolean isMatched = false;

    @Schema(description = "小程序是否显示")
    private Integer isShow = 1;

    @Schema(description = "哪些规格不计算金额")
    private String specificationShow;

    @Override
    public int hashCode() {
        int result = id.hashCode();
        result = 31 * result + (this.productId != null ? this.productId.hashCode() : 0);
        result = 31 * result + (this.productBaseId != null ? this.productBaseId.hashCode() : 0);
        result = 31 * result + (this.productBaseType != null ? this.productBaseType.hashCode() : 0);
        result = 31 * result + (this.skuId != null ? this.skuId.hashCode() : 0);
        result = 31 * result + (this.projectId != null ? this.projectId.hashCode() : 0);
        result = 31 * result + (this.specificationId != null ? this.specificationId.hashCode() : 0);
        result = 31 * result + (this.firstResourceId != null ? this.firstResourceId.hashCode() : 0);
        result = 31 * result + (this.costPrice != null ? this.costPrice.setScale(2, RoundingMode.HALF_UP).hashCode() : 0);
        result = 31 * result + (this.salePrice != null ? this.salePrice.setScale(2, RoundingMode.HALF_UP).hashCode() : 0);
        result = 31 * result + (this.specType != null ? this.specType.hashCode() : 0);
        return result;
    }
}
