package com.zhangmeng.model.entity;

import com.zhangmeng.model.base.baseEntity.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zhengmeng
 * @version 1.0
 * @date 2021年1月7日17:44:40
 */
@NoArgsConstructor
@Data
@AllArgsConstructor
@Entity
@EqualsAndHashCode(callSuper = false)
@Table(name = "role")
public class Role extends BaseEntity<Long> {

    public enum Type {

        Super_Administrator("超级管理员") ,//超级管理员
        Administrator("管理员"),//管理员
        User("用户");//用户

        private String description;//描述

        Type(String description) {
            this.description = description;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public static List<Map<String,Object>> enumListMap(){
            Type[] values = Type.values();
            List<Map<String, Object>> list = new ArrayList<>();
            for (Type value : values) {
                Map<String, Object> map = new HashMap<>();
                String description = value.getDescription();
                map.put("description",description);
                map.put("value",value);
                list.add(map);
            }
            return list;
        }
    }

    public enum Status {

        Enable("开启") ,
        DisEnable("关闭");

        private String description;//描述

        Status(String description) {
            this.description = description;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public static List<Map<String,Object>> enumListMap(){
            Status[] values = Status.values();
            List<Map<String, Object>> list = new ArrayList<>();
            for (Status value : values) {
                Map<String, Object> map = new HashMap<>();
                String description = value.getDescription();
                map.put("description",description);
                map.put("value",value);
                list.add(map);
            }
            return list;
        }
    }

    private String roleName;

    private String roleCode;

    private Status status;

    private String description;

    private Type type;

    private Long createUserId;

}
