/*
*  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 cn.ysk.cashier.pojo.shop;

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 java.math.BigDecimal;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-01-18
**/
@Entity
@Data
@Table(name="tb_shop_table")
public class TbShopTable implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "自增id")
    private Integer id;

    @Column(name = "`name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "name")
    private String name;

    @Column(name = "`shop_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "shopId")
    private Integer shopId;

    @Column(name = "`max_capacity`")
    @ApiModelProperty(value = "客座数,允许的客座数量")
    private Integer maxCapacity;

    @Column(name = "`sort`")
    @ApiModelProperty(value = "台桌排序")
    private Integer sort;

    @Column(name = "`area_id`")
    @ApiModelProperty(value = "区域Id")
    private Integer areaId;

    @Column(name = "`is_predate`")
    @ApiModelProperty(value = "是否接受网络预定")
    private Integer isPredate;

    @Column(name = "`predate_amount`")
    @ApiModelProperty(value = "网络预定台桌支付金额")
    private BigDecimal predateAmount = new BigDecimal("0.00");

    @Column(name = "`status`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "subscribe预定，closed--关台， opening 开台中，cleaning 台桌清理中")
    private String status = "opening";

    @Column(name = "`type`")
    @ApiModelProperty(value = "台桌计算价格类型，0-低消类型，amount    2计时类型")
    private Integer type;

    @Column(name = "`amount`")
    @ApiModelProperty(value = "当type=0时，amount生效,为台桌的低消金额")
    private BigDecimal amount;

    @Column(name = "`perhour`")
    @ApiModelProperty(value = "当type=2时perhour生效，为计时类型,每小时收款金额")
    private BigDecimal perhour;

    @Column(name = "`view`")
    @ApiModelProperty(value = "台桌展示图---预留")
    private String view;

    @Column(name = "`created_at`")
    @ApiModelProperty(value = "createdAt")
    private Long createdAt;

    @Column(name = "`updated_at`")
    @ApiModelProperty(value = "updatedAt")
    private Long updatedAt;

    @Column(name = "`qrcode`")
    @ApiModelProperty(value = "二维码")
    private String qrcode = "";

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

}
