/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package easydo.technology.system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import easydo.technology.base.CommonEntity;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

@Setter
@Getter
@TableName("sys_dept")
public class Dept extends CommonEntity {
    private static final long serialVersionUID = 1L;

    @TableId(value = "dept_id", type = IdType.AUTO)
    private Long id;

    @NotNull
    private Long pid;

    private Integer subCount;

    @NotBlank
    private String name;

    private Integer deptSort;

    @NotNull
    private Boolean enabled;

    @NotNull
    private String firmType;

    @NotNull
    private String firmCredit;

    @NotNull
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime firmTime;

    @NotNull
    private String firmAddress;

    @NotNull
    private String firmCapital;

    @NotNull
    private String firmNature;

    @NotNull
    private String firmLegalPerson;

    @NotNull
    private String firmLegalPersonPhone;

    @NotNull
    private String firmFunctionary;

    @NotNull
    private String firmFunctionaryPhone;

    @NotNull
    private String firmOfficePhone;

    @NotNull
    private String firmFaxNumber;

    @NotNull
    private String firmBusinessAddress;

    @NotNull
    private String remark;

    public void copyFrom(Dept source) {
        BeanUtils.copyProperties(source, this);
    }
}