package com.izouma.dingdong.domain.merchant;


import com.izouma.dingdong.converter.LongArrayConverter;
import com.izouma.dingdong.converter.StringArrayConverter;
import com.izouma.dingdong.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;


import javax.persistence.*;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Builder
@ApiModel(value = "商家自定义分类")
public class MerchantClassification extends BaseEntity implements Serializable {

    //private Long userId;

    @ApiModelProperty(value = "名称", name = "name")
    @Column(length = 50)
    @Size(max = 50)
    private String name;

    @ApiModelProperty(value = "排序", name = "sort")
    private Integer sort;

    @ApiModelProperty(value = "商户ID", name = "merchantId")
    private Long merchantId;

/*    @ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.DETACH})
    @JoinTable(
            name = "goods_class",
            joinColumns = {@JoinColumn(name = "mer_id", referencedColumnName = "merchantId", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))},
            inverseJoinColumns = {@JoinColumn(name = "class_name", referencedColumnName = "name", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))})
    @BatchSize(size = 20)
    @ApiModelProperty(value = "商品列表", name = "goodsList")
    private Set<Goods> goodsList;*/

//    @Convert(converter = LongArrayConverter.class)
//    private List<Long> goodsIds ;

    private String goodsIds;

    @ApiModelProperty(value = "是否开启", name = "isOpen")
    private Boolean isOpen;

    @ApiModelProperty(value = "是否显示", name = "isShow")
    private Boolean isShow;

}
