/*
*  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.dmReadingRoomConfig.domain;

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 me.zhengjie.modules.dm.dmReadingRoomConfig.service.dto.DmReadingRoomConfigDto;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author longda
* @date 2022-02-24
**/
@Entity
@Data
@Table(name="dm_reading_room_config")
public class DmReadingRoomConfig extends BaseEntity implements Serializable {
    @Column(name = "borrow_msg_type",nullable = false)
    @NotNull
    @ApiModelProperty(value = "00 邮箱  01手机  02 短信")
    private String borrowMsgType;

    @Id
    @Column(name = "borrow_config_id")
    @ApiModelProperty(value = "设置id")
    @NotNull(groups = {BaseEntity.Update.class})
    private String borrowConfigId;

    @Column(name = "overdue_amount",nullable = false)
    @NotNull
    @ApiModelProperty(value = "逾期金额")
    private BigDecimal overdueAmount;

    @Column(name = "overdue_amount_max",nullable = false)
    @NotNull
    @ApiModelProperty(value = "扣费上限")
    private BigDecimal overdueAmountMax;

    @Column(name = "overdue_time_msg")
    @ApiModelProperty(value = "逾期时间设置提醒")
    @NotNull
    private String overdueTimeMsg;

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