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

/**
* @author admin
* @date 2024-07-03
**/
@Entity
@Data
@Table(name="view_cons_supp_flow")
public class ViewConsSuppFlow implements Serializable {

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

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

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

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

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

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

    @Column(name = "`type`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "出入库类型: in 入库 out 出库")
    private String type;

    @Column(name = "`stock_number`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "数量")
    private BigDecimal stockNumber;

    @Column(name = "`price`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "进价")
    private BigDecimal price;

    @Column(name = "`amount`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "小计")
    private BigDecimal amount;

    @Column(name = "`balance`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "剩余库存")
    private BigDecimal balance;

    @Column(name = "`accounts_payable`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "应付款")
    private BigDecimal accountsPayable;

    @Column(name = "`actual_payment`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "实付款")
    private BigDecimal actualPayment;

    @Column(name = "`payment_time`")
    @ApiModelProperty(value = "paymentTime")
    private Timestamp paymentTime;

    @Column(name = "`create_time`")
    @ApiModelProperty(value = "createTime")
    private Timestamp createTime;

    @Column(name = "`update_time`")
    @ApiModelProperty(value = "updateTime")
    private Timestamp updateTime;

    @Column(name = "`con_name`")
    @ApiModelProperty(value = "耗材名称")
    private String conName;

    @Column(name = "`con_code`")
    @ApiModelProperty(value = "耗材代码")
    private String conCode;

    @Column(name = "`con_type_name`")
    @ApiModelProperty(value = "耗材类型名称")
    private String conTypeName;

    @Column(name = "`purveyor_name`")
    @ApiModelProperty(value = "联系人名字")
    private String purveyorName;

    @Column(name = "`address`")
    @ApiModelProperty(value = "供应商地址")
    private String address;

    @Column(name = "`purveyor_telephone`")
    @ApiModelProperty(value = "联系人电话")
    private String purveyorTelephone;

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