package com.cyksj.model.manage.views;

import com.cyksj.model.entity.GroupsTrips;
import com.ejlchina.searcher.bean.DbField;
import com.ejlchina.searcher.bean.DbIgnore;
import com.ejlchina.searcher.bean.SearchBean;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author chan
 * @date 2022/10/12 12:02 PM
 */
@Getter
@Setter
@SearchBean(tables = "account a left join goods_don g on a.goods_id = g.id " +
        "left join groups_trips gt on gt.account_id = a.id " +
        "left join goods_don_sku gdk on gdk.id = gt.sku_id",
        where = ":extra_sql:")
public class AccountView {

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

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

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

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

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

    @DbField("a.bank_card")
    private String bankCard;

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

    @DbField("a.gpt_email_pwd")
    private String emailPassword;

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

    @DbField("a.is_month")
    private Boolean isMonth;

    @DbField("a.api_key")
    private String apiKey;

    @DbField("a.gpt_email_pwd")
    private String gptEmailPwd;

    @DbField("a.verify_codes")
    private String verifyCodes;

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

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

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

    @DbField("a.amount")
    private BigDecimal amount;

    /**
     * 国区id
     */
    @DbField("a.cn_account")
    private String cnAccount;

    /**
     * 美区id
     */
    @DbField("a.us_account")
    private String usAccount;

    @DbField("a.customer_service_id")
    private Long customerServiceId;

    @DbField("a.secret")
    private String secret;

    @DbIgnore
    private String customerServiceName;

    @DbIgnore
    private Integer invited;

    @DbIgnore
    private Integer unInvited;

    @DbIgnore
    private Integer total;

    @DbField("gt.id")
    private Long groupsId;

    @DbField("gt.status")
    private GroupsTrips.Status gtStatus;

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

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

    /**
     * 账号备注
     */
    @DbField("a.remark")
    private String remark;

    @DbField("a.email")
    private String email;

    @DbField("gdk.id")
    private Long skuId;

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

    @DbField("a.gpt_refresh_token")
    private String gptRefreshToken;

    /**
     * 规格
     */
    @DbField("gdk.spec_val")
    private String specVal;

    @DbField("a.created_time")
    private Date createdTime;

    //@DbField("select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self' :yesTime:")
    @DbIgnore
    private Integer expiryCount;

    //@DbField("if((select count(distinct relation_id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self' :yesTime:)>=5,true,false)")
    @DbIgnore
    private Boolean expiredAll;

    /**
     * 今日有过期人员
     */
    @DbIgnore
    private Boolean hadExpiredToDay;

    @DbIgnore
    private Integer updatePwdNum;

    @DbIgnore
    private Date lastUpdatePwdDate;

    @DbField("a.pre_sku_ids")
    private String preSkuIds;

    @DbField("a.type")
    private Integer accountType;

    @DbIgnore
    private Boolean isMjMirror;

    @DbField("a.is_disable")
    private Boolean isDisable;

    @DbField("a.cookie")
    private String cookie;

    @DbField("a.relate_email")
    private String relateEmail;

    @DbField("a.type")
    private Integer type;

    @DbField("a.verify_link")
    private String verifyLink;

    /**
     * 是否外部采购
     */
    @DbField("a.outside_purchase")
    private Boolean outsidePurchase;

    /**
     * 激活码
     */
    @DbField("a.act_code")
    private String actCode;
}
