package com.bonus.core.allocation.alloc.model;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.bonus.core.common.enums.MetadataModelTypeEnum;
import com.bonus.framework.config.deserializer.DateTimeDeserializer;
import com.bonus.framework.config.serializer.DateTimeSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.ArrayList;

@TableName("alloc_metadata")
@ApiModel("元数据配置表")
@Data
public class AllocMetadata {
   @TableId
   @ApiModelProperty("元数据id")
   private Long metadataId;
   @ApiModelProperty("区域id")
   private Long areaId;
   @ApiModelProperty("食堂id")
   private Long canteenId;
   @ApiModelProperty("档口id")
   private Long stallId;
   @ApiModelProperty("是否有效 1是2否")
   private Integer ifActive;
   @ApiModelProperty("模型类型")
   private String modelType;
   @ApiModelProperty("模型key")
   private String modelKey;
   @ApiModelProperty("模型值")
   private String modelValue;
   @ApiModelProperty("模型key备注")
   private String modelKeyRemark;
   @ApiModelProperty("创建人")
   private String crby;
   @ApiModelProperty("创建时间")
   private LocalDateTime crtime;
   @ApiModelProperty("更新人")
   private String upby;
   @ApiModelProperty("更新时间")
   private LocalDateTime uptime;
   public String uniqueKey() {
      ArrayList<Object> keys = ListUtil.toList(new Object[]{this.areaId, this.canteenId, this.stallId, this.modelType, this.modelKey});
      return CollUtil.join(keys, ",");
   }
}
