package com.xinyilu.system.domain.classinfo;

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 org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.YearMonth;

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

    /**
     * 幼儿园信息表id
     */
    @ApiModelProperty(value = "幼儿园信息表id")
    @NotNull(message = "所属幼儿园不能位空", groups = {Insert.class, Update.class})
    private Long kindergartenId;

    /**
     * 班级名称
     */
    @ApiModelProperty(value = "班级名称")
    @NotBlank(message = "班级名称不能为空", groups = {Insert.class, Update.class})
    private String className;

    /**
     * 班级类型，LARGE_CLASS：大班，MIDDLE_CLASS：中班，SMALL_CLASS：小班，GRADUATE：毕业
     */
    @ApiModelProperty(value = "班级类型，LARGE_CLASS：大班，MIDDLE_CLASS：中班，SMALL_CLASS：小班，GRADUATE：毕业")
    @NotBlank(message = "班级类型不能为空", groups = {Insert.class, Update.class})
    private String classType;

    /**
     * 班主任姓名
     */
    @ApiModelProperty(value = "班主任姓名")
    @NotBlank(message = "班级名称不能为空", groups = {Insert.class, Update.class})
    private String classTeacher;

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

    /**
     * 入学时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate entranceDate;


    /**
     * 是否删除，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("kindergartenId", getKindergartenId())
                .append("className", getClassName())
                .append("classType", getClassType())
                .append("classTeacher", getClassTeacher())
                .append("phone", getPhone())
                .append("delFlag", getDelFlag())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .append("entranceDate", getEntranceDate())
                .toString();
    }
}
