package com.ruoyi.ss.complaint.domain;

import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.ValidGroup;
import com.ruoyi.common.valid.EnumValid;
import com.ruoyi.ss.complaint.domain.enums.ComplaintType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 投诉对象 sm_complaint
 *
 * @author ruoyi
 * @date 2024-03-02
 */
@Data
public class SmComplaint extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    @Excel(name = "id")
    private Long id;

    /** 用户 */
    @Excel(name = "用户")
    @ApiModelProperty("用户id")
    private Long userId;

    /** 内容 */
    @Excel(name = "内容")
    @ApiModelProperty("内容")
    @NotNull(message = "内容必填", groups = {ValidGroup.FrontCreate.class})
    @Size(max = 500, message = "内容长度不允许超过500", groups = {ValidGroup.FrontCreate.class})
    private String content;

    @Excel(name = "类型")
    @ApiModelProperty("类型")
    @EnumValid(
            clazz = ComplaintType.class,
            message = "非法的投诉建议类型",
            method = "getType",
            allowNull = false,
            groups = {ValidGroup.FrontCreate.class}
    )
    private String type;

    @ApiModelProperty("图片路径")
    private String picture;

    @Excel(name = "联系方式")
    @ApiModelProperty("联系方式")
    private String contact;

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("userId", getUserId())
            .append("createTime", getCreateTime())
            .append("content", getContent())
            .toString();
    }
}
