package com.persagy.server.messagecenter.models.entities


import com.persagy.server.messagecenter.models.entities.base.RBaseInfo
import com.alibaba.fastjson.annotation.JSONField
import com.fasterxml.jackson.annotation.JsonProperty
import com.persagy.server.datacenter.models.entities.objects.Project
import com.persagy.service.models.annotations.SCascade
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import javax.persistence.Column
import javax.persistence.Id
import javax.persistence.Table

/**
 * 消息中心
 *
 * @author  邓婷婷
 */
@ApiModel(description = "消息中心实体类")
@Table(name = "message.message")
open class Message: RBaseInfo(){

    /** ID */
    @ApiModelProperty(value = "ID")
    @Id
    @Column(name = "id")
    @JsonProperty("Id")
    var id: String? = null

    /** 项目ID */
    @ApiModelProperty(value = "项目ID")
    @Column(name = "project_id")
    @JsonProperty("ProjectId")
    var projectId: String? = null

    /** 标题 */
    @ApiModelProperty(value = "标题")
    @Column(name = "title")
    @JSONField(name = "Title")
    var title: String? = null

    /** 发送消息的模块 */
    @ApiModelProperty(value = "发送消息的模块")
    @Column(name = "module")
    @JSONField(name = "Module")
    var module: String? = null

    /** 枚举类型: Info, Warning, Error, Success */
    @ApiModelProperty(value = "枚举类型: Info, Warning, Error, Success")
    @Column(name = "type")
    @JSONField(name = "Type")
    var type: String? = null

    /** 消息内容 */
    @ApiModelProperty(value = "消息内容")
    @Column(name = "content")
    @JSONField(name = "Content")
    var content: MessageContent? = null

    /** 用户id */
    @ApiModelProperty(value = "用户id")
    @Column(name = "user_id")
    @JSONField(name = "UserId")
    var userId: String? = null

    /** 是否已读 */
    @ApiModelProperty(value = "是否已读")
    @Column(name = "read")
    @JSONField(name = "Read")
    var read: Boolean? = null

    /** 级联-项目 */
    @ApiModelProperty(value = "级联-项目")
    @SCascade(table="message.message", idColumn="id", childIdColumn="project_id")
    @JSONField(name = "Project")
    var project: ArrayList<Project>? = null

} // Class Message