/*
*  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.modules.dm.dmAttendanceRecord.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.modules.dm.dmCard.domain.DmCard;
import me.zhengjie.modules.dmuser.domain.DmUser;
import me.zhengjie.ykt.domain.DmRoomDevice;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author juan
* @date 2021-11-23
**/
@Entity
@Data
@Table(name="dm_attendance_record")
public class DmAttendanceRecord implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @OneToOne
    @JoinColumn(name = "user_number",referencedColumnName="id")
    @ApiModelProperty(value = "DM用户")
    private DmUser dmUser;

    @Column(name = "card_number")
    @ApiModelProperty(value = "卡号")
    private String cardNumber;

    @Column(name = "room_device")
    @ApiModelProperty(value = "门禁设备编号")
    private String roomDevice;

    @Column(name = "property")
    @ApiModelProperty(value = "考勤属性")
    private String property;

    @Column(name = "attendance_time")
    @ApiModelProperty(value = "考勤时间")
    private Timestamp attendanceTime;

    @Column(name = "attendance_photo")
    @ApiModelProperty(value = "考勤照片")
    private String attendancePhoto;

    @Column(name = "open")
    @ApiModelProperty(value = "是否开闸")
    private Boolean open;

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