package com.xinyilu.system.domain.parentInfo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinyilu.common.core.domain.BaseEntity;
import com.xinyilu.common.custominterface.Insert;
import com.xinyilu.common.custominterface.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

/**
 * 家长信息对象 parent_info
 *
 * @author jihan
 * @date 2022-07-29
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "家长信息对象", description = "parent_info")
public class ParentInfo extends BaseEntity implements Serializable {
    private static final long serialVersionUID = -8668271896597412348L;
    /**
     * 主键id
     */
    @NotNull(message = "id不能位空", groups = {Update.class})
    private Long id;

    /**
     * 微信openid
     */
    @ApiModelProperty(value = "微信openid")
    private String openid;

    /**
     * 用于微信
     */
    @ApiModelProperty(value = "用于微信")
    private String unionid;

    /**
     * 家长姓名
     */
    @ApiModelProperty(value = "家长姓名")
    @NotBlank(message = "家长姓名不能位空", groups = {Insert.class, Update.class})
    private String parentName;

    /**
     * 家长性别，MALE：男，FEMALE
     */
    @ApiModelProperty(value = "家长性别，MALE：男，FEMALE")
    @NotBlank(message = "家长性别不能位空", groups = {Insert.class, Update.class})
    private String parentSex;

    /**
     * 联系电话
     */
    @ApiModelProperty(value = "联系电话")
    @NotBlank(message = "联系电话不能位空", groups = {Insert.class, Update.class})
    @Size(min = 0, max = 11, message = "电话长度不能超过11位")
    private String phone;

    /**
     * 头像地址
     */
    @ApiModelProperty(value = "头像地址")
    private String avatar;

    /**
     * 密码
     */
    @ApiModelProperty(value = "密码")
    private String password;

    /**
     * 最后登录IP
     */
    @ApiModelProperty(value = "最后登录IP")
    private String loginIp;

    /**
     * 最后登录时间
     */
    @ApiModelProperty(value = "最后登录时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date loginDate;

    /**
     * 帐号状态（0正常 1停用）
     */
    @ApiModelProperty(value = "帐号状态")
    private String status;

    /**
     * 是否删除，0：否，1：是
     */
    private Integer delFlag;

    /**
     * 用户表id
     */
    private Long userId;

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("openid", getOpenid())
                .append("unionid", getUnionid())
                .append("parentName", getParentName())
                .append("parentSex", getParentSex())
                .append("phone", getPhone())
                .append("avatar", getAvatar())
                .append("password", getPassword())
                .append("loginIp", getLoginIp())
                .append("loginDate", getLoginDate())
                .append("status", getStatus())
                .append("delFlag", getDelFlag())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
