package com.xinelu.manage.domain.hospitaldepartmentinfo;

import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;
import com.xinelu.common.custominterface.Insert;
import com.xinelu.common.custominterface.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Objects;

/**
 * 科室信息管理对象 hospital_department_info
 *
 * @author
 * @date 2023-02-13
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "科室信息管理对象", description = "hospital_department_info")
public class HospitalDepartmentInfo extends BaseDomain {
    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    private Long id;

    /**
     * 父级科室id
     */
    @ApiModelProperty(value = "父级科室id")
    @Excel(name = "父级科室id")
    private Long parentId;

    /**
     * 医院表id
     */
    @ApiModelProperty(value = "医院表id")
    @Excel(name = "医院表id")
    @NotNull(message = "医院信息不能为空", groups = {Insert.class, Update.class})
    private Long hospitalId;

    /**
     * 医院名称
     */
    @ApiModelProperty(value = "医院名称")
    @Excel(name = "医院名称")
    @NotBlank(message = "医院名称不能为空", groups = {Insert.class, Update.class})
    private String hospitalName;

    /**
     * 科室编码
     */
    @ApiModelProperty(value = "科室编码")
    @Excel(name = "科室编码")
    private String departmentCode;

    /**
     * 科室名称
     */
    @ApiModelProperty(value = "科室名称")
    @Excel(name = "科室名称")
    @NotBlank(message = "科室名称不能为空", groups = {Insert.class, Update.class})
    @Length(max = 50, message = "科室名称不能超过50位", groups = {Insert.class, Update.class})
    private String departmentName;

    /**
     * 科室联系电话，手机号或者座机号
     */
    @ApiModelProperty(value = "科室联系电话，手机号或者座机号")
    @Excel(name = "科室联系电话，手机号或者座机号")
    private String departmentPhone;

    /**
     * 科室负责人名称
     */
    @ApiModelProperty(value = "科室负责人名称")
    @Excel(name = "科室负责人名称")
    @Length(max = 20, message = "科室负责人名称不能超过20位", groups = {Insert.class, Update.class})
    private String departmentPerson;

    /**
     * 科室地址
     */
    @ApiModelProperty(value = "科室地址")
    @Excel(name = "科室地址")
    @Length(max = 300, message = "科室地址不能超过300位", groups = {Insert.class, Update.class})
    private String departmentAddress;

    /**
     * 科室显示级别
     */
    @ApiModelProperty(value = "科室显示级别")
    @Excel(name = "科室显示级别")
    private Integer departmentLevel;

    /**
     * 科室显示顺序
     */
    @ApiModelProperty(value = "科室显示顺序")
    @Excel(name = "科室显示顺序")
    @NotNull(message = "科室显示顺序不能为空", groups = {Insert.class, Update.class})
    private Integer departmentSort;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        HospitalDepartmentInfo that = (HospitalDepartmentInfo) o;
        return Objects.equals(hospitalId, that.hospitalId) && Objects.equals(departmentName, that.departmentName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(hospitalId, departmentName);
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("parentId", getParentId())
                .append("hospitalId", getHospitalId())
                .append("hospitalName", getHospitalName())
                .append("departmentCode", getDepartmentCode())
                .append("departmentName", getDepartmentName())
                .append("departmentPhone", getDepartmentPhone())
                .append("departmentPerson", getDepartmentPerson())
                .append("departmentAddress", getDepartmentAddress())
                .append("departmentLevel", getDepartmentLevel())
                .append("departmentSort", getDepartmentSort())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
