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

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-03-02
**/
@Entity
@Data
@Table(name="tb_cashier_cart")
public class TbCashierCart implements Serializable {

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

    @Column(name = "`master_id`")
    @ApiModelProperty(value = "主单Id")
    private String masterId;

    @Column(name = "`order_id`")
    @ApiModelProperty(value = "本次下单Id")
    private Integer orderId;

    @Column(name = "`ref_order_id`")
    @ApiModelProperty(value = "退单Id")
    private Integer refOrderId;

    @Column(name = "`total_amount`")
    @ApiModelProperty(value = "购物车总额")
    private BigDecimal totalAmount;

    @Column(name = "`product_id`")
    @ApiModelProperty(value = "商品Id")
    private String productId;

    @Column(name = "`cover_img`")
    @ApiModelProperty(value = "商品图片")
    private String coverImg;

    @Column(name = "`is_sku`")
    @ApiModelProperty(value = "是否sku")
    private String isSku;

    @Column(name = "`sku_id`")
    @ApiModelProperty(value = "skuId")
    private String skuId;

    @Column(name = "`name`")
    @ApiModelProperty(value = "商品名")
    private String name;

    @Column(name = "`sale_price`")
    @ApiModelProperty(value = "单价")
    private BigDecimal salePrice;

    @Column(name = "`number`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "结余数量")
    private Integer number;

    @Column(name = "`total_number`")
    @ApiModelProperty(value = "总下单数量")
    private Integer totalNumber;

    @Column(name = "`refund_number`")
    @ApiModelProperty(value = "退单数量")
    private Integer refundNumber;

    @Column(name = "`category_id`")
    @ApiModelProperty(value = "分类Id")
    private String categoryId;

    @Column(name = "`status`")
    @ApiModelProperty(value = "'购物车关闭 closed',' 购物车挂起 refund',' 购物车列表生效create',' 购物车完成final'")
    private String status;

    @Column(name = "`type`")
    @ApiModelProperty(value = "是否为组合商品 0-单商品 1为组合商品")
    private Integer type;

    @Column(name = "`merchant_id`")
    @ApiModelProperty(value = "商户Id")
    private String merchantId;

    @Column(name = "`shop_id`")
    @ApiModelProperty(value = "店铺Id")
    private String shopId;

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

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

    @Column(name = "`user_id`")
    @ApiModelProperty(value = "用户的openId")
    private Integer userId;

    @Column(name = "`table_id`")
    @ApiModelProperty(value = "台桌id")
    private Long tableId;

    @Column(name = "`pack_fee`")
    @ApiModelProperty(value = "打包费")
    private BigDecimal packFee;

    @Column(name = "`trade_day`")
    @ApiModelProperty(value = "tradeDay")
    private String tradeDay;

    @Column(name = "`is_pack`")
    @ApiModelProperty(value = "isPack")
    private String isPack;

    @Column(name = "`is_gift`")
    @ApiModelProperty(value = "isGift")
    private String isGift;

    @Column(name = "`pending_at`")
    @ApiModelProperty(value = "pendingAt")
    private Long pendingAt;

    @Column(name = "`uuid`")
    @ApiModelProperty(value = "uuid")
    private String uuid;
    @Column(name = "`sku_name`")
    private String skuName;

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