package com.cyksj.model.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/**
 * @author chan
 * @date 2022/9/26 6:31 PM
 */
@Getter
@Setter
@SearchBean(tables = "groups_trips gt left join goods_don_sku sku on gt.sku_id = sku.id " +
        "left join goods_don g on g.id = sku.goods_id " +
        "left join account a on a.id = gt.account_id ")
public class GroupsTrips {

    @TableId(value = "id",type = IdType.AUTO)
    @DbField("gt.id")
    private Long id;

    @DbField("gt.id")
    @TableField(exist = false)
    private Long groupId;

    /**
     * 商品skuId
     */
    @DbField("gt.sku_id")
    private Long skuId;

    /**
     * 账号id
     */
    @DbField("gt.account_id")
    private Long accountId;


    /**
     * 账号
     */
    @DbField("a.account")
    @TableField(exist = false)
    private String account;

    /**
     * 密码
     */
    @DbField("a.password")
    @TableField(exist = false)
    private String password;

    /**
     * 商品id
     */
    @DbField("g.id")
    @TableField(exist = false)
    private Long goodsId;

    /**
     * 标题
     */
    @DbField("g.title")
    @TableField(exist = false)
    private String title;

    /**
     * 是否是第三方平台
     */
    @DbField("g.is_third_goods")
    @TableField(exist = false)
    private Boolean isThirdGoods;

    /**
     * 商品规格
     */
    @DbField("sku.spec_val")
    @TableField(exist = false)
    private String specVal;

    /**
     * 商品规格
     */
    @DbField("sku.is_mirror")
    @TableField(exist = false)
    private Boolean isMirror;

    /**
     * 录入人
     */
    @DbField("gt.writer")
    private Long writer;

    /**
     * 车位数量
     */
    @DbField("gt.num")
    private Integer num;

    /**
     * 可用车位数
     */
    @DbField("gt.available_num")
    private Integer availableNum;

    /**
     * 状态
     */
    @DbField("gt.status")
    private Status status;

    /**
     * 备注
     */
    @DbField("gt.remark")
    private String remark;

    /**
     * 开时间
     */
    @DbField("gt.start_time")
    private Date startTime;

    @DbIgnore
    @TableField(exist = false)
    private String verifyCodes;

    @DbField("gt.renewal_time")
    private Date renewalTime;

    @DbField("a.expiry_time")
    @TableField(exist = false)
    private Date expiryTime;

    @DbField("a.is_disable")
    @TableField(exist = false)
    private Boolean isDisable;

    @DbField("a.act_code")
    @TableField(exist = false)
    private String actCode;

    @DbField("a.email")
    @TableField(exist = false)
    private String email;

    @DbField("a.relate_email")
    @TableField(exist = false)
    private String relateEmail;

    /**
     * 车队上是否有人
     */
    @DbIgnore
    @TableField(exist = false)
    private Boolean isExists;

    /**
     * 可上车队时间
     */
    @DbField("gt.parking_time")
    private Date parkingTime;

    /**
     * 目前可停车数目
     */
    @DbField("gt.available_parking_num")
    private Integer availableParkingNum;

    /**
     * 创建时间
     */

    @DbField("gt.created_time")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    /**
     * 修改时间
     */
    @DbField("gt.update_time")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;


    @AllArgsConstructor
    @Getter
    public enum Status{
        waiting("等待发车"),
        validity("已发车"),
        down("下架"),
        close("关闭");

        private String desc;

    }
}
