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

import com.youchain.base.BaseEntity;
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 javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author huojin
* @date 2023-08-17
**/
@Entity
@Data
@Table(name="base_box")
public class Box  extends BaseEntity implements Serializable {

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

    @Column(name = "`code`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "按钮盒编号")
    private String code;

    @Column(name = "`name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "按钮盒名称")
    private String name;

    @OneToOne
    @JoinColumn(name = "`item_id`",nullable = true)
    @ApiModelProperty(value = "物料")
    private Item item;

    @OneToOne
    @JoinColumn(name = "`point_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "点位")
    private Point point;

    @Column(name = "`enabled`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "状态：1启用、0禁用")
    private Boolean enabled=true;

    @Column(name = "`order_Number`")
    @ApiModelProperty(value = "工单号")
    private String orderNumber;

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

    @Column(name = "`sort`")
    @ApiModelProperty(value = "排序")
    private int sort=0;

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

    @Column(name = "`lamp_status`")
    @ApiModelProperty(value = "指示灯状态")
    private String lampStatus;

    @Column(name = "`lamp_code`")
    @ApiModelProperty(value = "按钮盒编号")
    private String lampCode;
    public void copy(Box source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
