/*
*  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 me.zhengjie.ykt.domain;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;

import me.zhengjie.base.BaseEntity;
import org.hibernate.annotations.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.sql.Timestamp;
import java.io.Serializable;
import java.util.Date;

/**
* @website https://el-admin.vip
* @description /
* @author zhirong
* @date 2021-11-19
**/
@Entity
@Data
@Table(name="dm_room_device")
public class DmRoomDevice implements Serializable {

    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long id;

    @Column(name = "code")
    @ApiModelProperty(value = "设备编号")
    private String code;

    @Column(name = "name")
    @ApiModelProperty(value = "设备名称")
    private String name;

    @Column(name = "door_id")
    @ApiModelProperty(value = "门禁id")
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long doorID;

    @Column(name = "door_name")
    @ApiModelProperty(value = "门禁名称")
    private String doorName;

    @Column(name = "device_type")
    @ApiModelProperty(value = "设备类型 0：表示全部设备 1：控制器 2：二维码一体机 3：人脸识别机 4：指纹机")
    private Integer deviceType;

    @Column(name = "build_address")
    @ApiModelProperty(value = "设备安装位置")
    private String buildAddress;

    @Column(name = "status")
    @ApiModelProperty(value = "设备状态(00-启用、01-禁用、02-待维修)")
    private String status;

    @Column(name = "regist_time")
    @ApiModelProperty(value = "设备登记时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH;mm:ss")
    private Timestamp registTime;

    @Column(name = "remark")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Column(name = "create_by")
    @ApiModelProperty(value = "创建者")
    private String createBy;

    @Column(name = "update_by")
    @ApiModelProperty(value = "更新者")
    private String updateBy;

    @Column(name = "create_time")
    @CreationTimestamp
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    @Column(name = "update_time")
    @UpdateTimestamp
    @ApiModelProperty(value = "更新时间")
    private Timestamp updateTime;

    public void copy(DmRoomDevice source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}