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

import cn.ysk.cashier.dto.shop.TbShopPermissionDto;
import cn.ysk.cashier.system.service.dto.RoleSmallDto;
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;
import java.util.List;

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

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

    @Column(name = "`code`")
    @ApiModelProperty(value = "员工编号")
    private String code;

    @Column(name = "`name`")
    @ApiModelProperty(value = "员工名称")
    private String name;

    @Column(name = "`account`")
    @ApiModelProperty(value = "登录账号")
    private String account;

    @Column(name = "`password`")
    @ApiModelProperty(value = "密码")
    private String password;

    @Column(name = "`discount_type`")
    @ApiModelProperty(value = "优惠类型 1 折扣 0 金额")
    private String discountType;

    @Column(name = "`max_discount_amount`")
    @ApiModelProperty(value = "最大优惠金额")
    private BigDecimal maxDiscountAmount;

    @Column(name = "`status`")
    @ApiModelProperty(value = "1启用0不启用")
    private Integer status;

    @Column(name = "`employee`")
    @ApiModelProperty(value = "登录端")
    private String employee;

    @Column(name = "`shop_id`")
    @ApiModelProperty(value = "shopId")
    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 = "type")
    @ApiModelProperty(value = "master商户账号staff员工")
    private String type="staff";

    @Column(name = "`is_manage`")
    @ApiModelProperty(value = "是否允许管理端登录 0：不允许；1：允许")
    private Integer isManage;

    @Column(name = "`is_pc`")
    @ApiModelProperty(value = "是否允许pc端登录 0：不允许；1：允许")
    private Integer isPc;

    @Transient
    private Long roleId;

    @Transient
    private String phone;

    @Transient
    List<TbShopPermissionDto> permissions;

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