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

/**
* @website https://eladmin.vip
* @description /
* @author lyf
* @date 2024-03-02
**/
@Entity
@Data
@Table(name="tb_order_info")
public class TbOrderInfo implements Serializable {

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

    @Column(name = "`order_no`")
    @ApiModelProperty(value = "订单编号")
    private String orderNo;

    @Column(name = "`settlement_amount`")
    @ApiModelProperty(value = "商户结算金额")
    private BigDecimal settlementAmount;

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

    @Column(name = "`origin_amount`")
    @ApiModelProperty(value = "订单原金额")
    private BigDecimal originAmount;

    @Column(name = "`product_amount`")
    @ApiModelProperty(value = "商品售价")
    private BigDecimal productAmount;

    @Column(name = "`amount`")
    @ApiModelProperty(value = "最终金额---退单后，金额变动")
    private BigDecimal amount;

    @Column(name = "`refund_amount`")
    @ApiModelProperty(value = "退单金额")
    private BigDecimal refundAmount;

    @Column(name = "`pay_amount`")
    @ApiModelProperty(value = "支付金额")
    private BigDecimal payAmount;

    @Column(name = "`freight_amount`")
    @ApiModelProperty(value = "订单邮递费用")
    private BigDecimal freightAmount;

    @Column(name = "`discount_amount`")
    @ApiModelProperty(value = "折扣金额")
    private BigDecimal discountAmount;

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

    @Column(name = "`small_change`")
    @ApiModelProperty(value = "订单抹零")
    private BigDecimal smallChange;

    @Column(name = "`send_type`")
    @ApiModelProperty(value = "发货类型")
    private String sendType;

    @Column(name = "`order_type`")
    @ApiModelProperty(value = "订单类型-cash收银-miniapp小程序-offline线下")
    private String orderType;

    @Column(name = "`product_type`")
    @ApiModelProperty(value = "订单里面商品的类型")
    private String productType;

    @Column(name = "`status`")
    @ApiModelProperty(value = "状态: unpaid 待支付unsend待发货  closed 订单完成   send 已发refunding申请退单refund退单cancelled取消订单merge合台")
    private String status;

    @Column(name = "`billing_id`")
    @ApiModelProperty(value = "orderType为union-minor时，parentId生效，为其上级合单id")
    private String billingId;

    @Column(name = "`merchant_id`")
    @ApiModelProperty(value = "对于平台订单,是收款商户Id")
    private String merchantId;

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

    @Column(name = "`is_vip`")
    @ApiModelProperty(value = "是否vip订单")
    private Integer isVip;

    @Column(name = "`member_id`")
    @ApiModelProperty(value = "商户会员Id")
    private String memberId;

    @Column(name = "`user_id`")
    @ApiModelProperty(value = "用户Id")
    private String userId;

    @Column(name = "`product_score`")
    @ApiModelProperty(value = "该订单商品赠送的积分")
    private Integer productScore;

    @Column(name = "`deduct_score`")
    @ApiModelProperty(value = "抵扣积分")
    private Integer deductScore;

    @Column(name = "`user_coupon_id`")
    @ApiModelProperty(value = "用户使用的卡券")
    private String userCouponId;

    @Column(name = "`user_coupon_amount`")
    @ApiModelProperty(value = "优惠券抵扣金额")
    private BigDecimal userCouponAmount;

    @Column(name = "`master_id`")
    @ApiModelProperty(value = "取餐码")
    private String masterId;

    @Column(name = "`refund_able`")
    @ApiModelProperty(value = "是否支持退款，1支持退单， 0不支持退单")
    private Integer refundAble;

    @Column(name = "`paid_time`")
    @ApiModelProperty(value = "支付时间")
    private Long paidTime;

    @Column(name = "`is_effect`")
    @ApiModelProperty(value = "是否生效，若订单合单之后，则原订单不会生效")
    private Integer isEffect;

    @Column(name = "`is_group`")
    @ApiModelProperty(value = "是否合台")
    private Integer isGroup;

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

    @Column(name = "`system_time`")
    @ApiModelProperty(value = "系统时间")
    private Long systemTime;

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

    @Column(name = "`is_accepted`")
    @ApiModelProperty(value = "收银台是否已接单")
    private Integer isAccepted;

    @Column(name = "`pay_type`")
    @ApiModelProperty(value = "支付类型")
    private String payType;

    @Column(name = "`order_amount`")
    @ApiModelProperty(value = "订单金额")
    private BigDecimal orderAmount;

    @Column(name = "`discount_ratio`")
    @ApiModelProperty(value = "折扣比例")
    private BigDecimal discountRatio;

    @Column(name = "`pay_order_no`")
    @ApiModelProperty(value = "支付订单号")
    private String payOrderNo;

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

    @Column(name = "`source`")
    @ApiModelProperty(value = "source")
    private Integer source;

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

    @Column(name = "`pay_remark`")
    @ApiModelProperty(value = "payRemark")
    private String payRemark;

    @Column(name = "`table_name`")
    @ApiModelProperty(value = "桌码")
    private String tableName;

    @Column(name = "`is_buy_coupon`")
    @ApiModelProperty(value = "是否购买优惠券")
    private String isBuyCoupon;

    @Column(name = "`out_number`")
    private String outNumber;

    @Column(name = "`is_use_coupon`")
    @ApiModelProperty(value = "是否使用优惠券")
    private String isUseCoupon;
    @Column(name = "`use_type`")
    private String useType;
    public void copy(TbOrderInfo source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
