package com.zhongshu.card.server.core.domain.dictionary;


import com.github.microservice.components.data.mongo.mongo.domain.SuperEntity;
import com.zhongshu.card.client.type.DictionaryType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

@Data
@Document
@AllArgsConstructor
@NoArgsConstructor
@CompoundIndexes(
        @CompoundIndex(name = "dictionary_key", def = "{'dictionary' : 1, 'key' : 1}", unique = true)
)
public class DictionaryItem extends SuperEntity {

    private String idString;

    //字典id
    @DBRef(lazy = true)
    private Dictionary dictionary;

    //父级id
    @Indexed
    private String parentId;

    //唯一值
    @Indexed
    private String key;

    //字典项
    private String name;

    private String description;

    //类型
    private DictionaryType type;

    //排序
    @Indexed
    private Integer sort;

    //禁用状态
    @Indexed
    private boolean disable;

}
