package com.xinyilu.system.domain.organize;

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;

/**
 * 组织对象 organize_info
 *
 * @author jihan
 * @date 2022-07-28
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "组织对象", description = "organize_info")
public class OrganizeInfo extends BaseEntity implements Serializable {
    private static final long serialVersionUID = -309355864164633812L;
    /**
     * 主键id
     */
    @NotNull(message = "主键id不能为空", groups = {Update.class})
    private Long id;

    /**
     * 父级id
     */
    @ApiModelProperty(value = "父级id")
    @NotNull(message = "所属父级组织不能位空", groups = {Insert.class, Update.class})
    private Long parentId;

    /**
     * 区域表id
     */
    @ApiModelProperty(value = "区域表id")
    @NotNull(message = "所属区域不能位空", groups = {Insert.class, Update.class})
    private Long areaId;

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

    /**
     * 组织地址
     */
    @ApiModelProperty(value = "组织地址")
    @NotBlank(message = "组织地址不能为空", groups = {Insert.class, Update.class})
    private String organizeAddress;

    /**
     * 联系电话
     */
    @ApiModelProperty(value = "联系电话")
    @Size(min = 0, max = 11, message = "联系电话长度不能超过11个字符")
    private String phone;

    /**
     * 联系人
     */
    @ApiModelProperty(value = "联系人")
    private String contacts;

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


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("parentId", getParentId())
                .append("areaId", getAreaId())
                .append("organizeName", getOrganizeName())
                .append("organizeAddress", getOrganizeAddress())
                .append("phone", getPhone())
                .append("contacts", getContacts())
                .append("delFlag", getDelFlag())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
