/*
*  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 com.youchain.businessdata.domain;

import com.youchain.base.BaseEntity;
import com.youchain.basicdata.domain.Item;
import com.youchain.modules.system.domain.Dept;
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.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author houjianlan
* @date 2023-08-21
**/
@Entity
@Data
@Table(name="data_item_key")
public class ItemKey  extends BaseEntity implements Serializable {

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

    @OneToOne
    @JoinColumn(name = "`item_id`")
    @ApiModelProperty(value = "物料序号")
    private Item item;

    @Column(name = "`prop_c1`")
    @ApiModelProperty(value = "批次号")
    private String propC1;

    @Column(name = "`prop_c2`")
    @ApiModelProperty(value = "序列号")
    private String propC2;

    @Column(name = "`prop_c3`")
    @ApiModelProperty(value = "属性4")
    private String propC3;

    @Column(name = "`prop_c4`")
    @ApiModelProperty(value = "属性4")
    private String propC4;

    @Column(name = "`prop_c5`")
    @ApiModelProperty(value = "属性5")
    private String propC5;

    @Column(name = "`prop_c6`")
    @ApiModelProperty(value = "属性6")
    private String propC6;

    @Column(name = "`prop_d1`")
    @ApiModelProperty(value = "生产日期")
    private Timestamp propD1;

    @Column(name = "`prop_d2`")
    @ApiModelProperty(value = "到期日期")
    private Timestamp propD2;

    @OneToOne
    @JoinColumn(name = "`dept_id`")
    @ApiModelProperty(value = "仓库ID")
    private Dept dept;

    @Column(name = "`order_number`")
    @ApiModelProperty(value = "箱号")
    private String orderNumber;


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