package com.cyksj.model.manage.views;

import com.cyksj.model.entity.GroupsRelation;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/**
 * @author chan
 * @date 2022/9/27 6:47 PM
 */
@Getter
@Setter
@SearchBean(tables = "groups_relation gr left join groups_trips gt on gr.groups_id = gt.id " +
        "left join account a on a.id = gt.account_id left join user u on gr.user_id = u.id " +
        "left join goods_don_sku sku on sku.id = gt.sku_id " +
        "left join goods_don g on g.id = sku.goods_id")
public class GroupsRelationView {

    @DbField("gr.id")
    private Long id;

    @DbField("gt.account_id")
    @JsonIgnore
    private Long accountId;

    @DbField("gt.sku_id")
    private Long skuId;

    @DbField("sku.is_mirror")
    private Boolean isMirror;

    @DbField("sku.spec_val")
    private String specVal;

    @DbField("a.account")
    @JsonIgnore
    private String tripsAccount;

    @DbField("a.password")
    @JsonIgnore
    private String tripsPassword;

    @DbField("a.api_secret")
    @JsonIgnore
    private String apiSecret;

    @DbField("a.created_time")
    @JsonIgnore
    private Date accountCreatedTime;

    @DbField("if(a.api_secret='',false,true)")
    private Boolean isVerify;

    @DbField("gr.verify_code")
    private String verifyCode;

    @DbField("g.id")
    private Long goodsId;

    @DbField("g.logo")
    private String logo;

    @DbField("g.type")
    private Integer goodsType;

    @DbField("g.second_type")
    private Integer goodsSecondType;

    @DbField("gr.groups_id")
    private Long groupsId;

    @DbField("g.title")
    private String title;

    @DbField("u.nickname")
    private String nickname;

    @DbField("gr.user_id")
    private Long userId;

    @DbField("gr.yhs_id")
    private Long yhsId;

    @DbField("gr.start_time")
    private Date startTime;

    @DbField("gr.expiry_time")
    private Date expiryTime;

    @DbField("gr.num")
    @JsonIgnore
    private Integer num;

    @DbField("gt.num")
    @JsonIgnore
    private Integer gtNum;

    /**
     * 车票获取类型 默认1购买,2.体验
     */
    @DbField("gr.aq_type")
    private Integer aqType;

    @DbField("u.nickname")
    private String nickName;

    @DbField("u.headimgurl")
    private String headimgurl;

    /**
     * locking 锁定中
     * overdue 过期
     * validity 有效
     * none 无人
     */
    @DbField("gr.status")
    private GroupsRelation.Status status;

    /**
     * 创建时间
     */
    @DbField("gr.created_time")
    @JsonIgnore
    private Date createdTime;

    /**
     * 创建时间
     */
    @DbField("gr.update_time")
    @JsonIgnore
    private Date update_time;

    @DbField("gr.is_vip")
    private Boolean isVip;

    /**
     * 账号
     */
    @DbField("gr.account")
    @JsonIgnore
    private String account;

    @DbIgnore
    private Date updateExpiryTime;

    @DbIgnore
    private String errorMsg;

    /**
     * 奈飞检测id
     */
    @DbIgnore
    private Long nfCheckId;

    /**
     * 奈飞原先订单id
     */
    @DbIgnore
    private Long nfOriOrderId;

    /**
     * 是否被冻结
     * 默认false
     */
    @DbField("gr.is_frozen")
    private Boolean isFrozen;

    /**
     * 解冻时长
     */
    @DbField("gr.unfrozen_time")
    private Date unfrozenTime;

    /**
     * 冻结保留天数
     */
    @DbField("gr.reserved_days")
    private Integer reservedDays;
}
