package com.rj.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 租户第三方集成配置（表 lb_third_integration_config）
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("lb_third_integration_config")
@Schema(description = "租户第三方集成配置")
@JsonIgnoreProperties(ignoreUnknown = true)
public class LbThirdIntegrationConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId("id")
    @Schema(description = "主键 UUID")
    private String id;

    @TableField("tenant_id")
    @Schema(description = "租户ID")
    private String tenantId;

    @TableField("provider_code")
    @Schema(description = "集成类型，如 HXR_ADMIN")
    private String providerCode;

    @TableField("enabled")
    @Schema(description = "总开关：1启用 0禁用")
    private Integer enabled;

    @TableField("admin_base_url")
    @Schema(description = "后台管理域名")
    private String adminBaseUrl;

    @TableField("web_base_url")
    @Schema(description = "前端 Web 域名")
    private String webBaseUrl;

    @TableField("order_select_path")
    @Schema(description = "订单列表 API 路径")
    private String orderSelectPath;

    @TableField("user_select_path")
    @Schema(description = "用户列表 API 路径")
    private String userSelectPath;

    @TableField("user_update_path")
    @Schema(description = "用户更新 API 路径")
    private String userUpdatePath;

    @TableField("goods_api_path")
    @Schema(description = "货品列表 API 路径")
    private String goodsApiPath;

    @TableField("buy_api_path")
    @Schema(description = "抢购 API 路径")
    private String buyApiPath;

    @TableField("order_page_limit")
    @Schema(description = "订单分页 limit")
    private Integer orderPageLimit;

    @TableField("user_page_limit")
    @Schema(description = "用户分页 limit")
    private Integer userPageLimit;

    @TableField("goods_page_limit")
    @Schema(description = "货品分页 limit")
    private Integer goodsPageLimit;

    @TableField("order_referer")
    @Schema(description = "订单 Referer")
    private String orderReferer;

    @TableField("user_referer")
    @Schema(description = "用户 Referer")
    private String userReferer;

    @TableField("goods_api_origin")
    @Schema(description = "货品 Origin")
    private String goodsApiOrigin;

    @TableField("goods_api_referer")
    @Schema(description = "货品 Referer")
    private String goodsApiReferer;

    @TableField("auth_type")
    @Schema(description = "Admin 鉴权类型")
    private String authType;

    @TableField("cookie")
    @Schema(description = "完整 Cookie 明文")
    private String cookie;

    @TableField("phpsid")
    @Schema(description = "PHPSID 明文")
    private String phpsid;

    @TableField("goods_api_token")
    @Schema(description = "货品/抢购 token 明文")
    private String goodsApiToken;

    @TableField("goods_api_app_str")
    @Schema(description = "签名密钥 appStr 明文")
    private String goodsApiAppStr;

    @TableField("credential_version")
    @Schema(description = "凭证版本号")
    private Integer credentialVersion;

    @TableField("credential_expire_time")
    @Schema(description = "凭证预计过期时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime credentialExpireTime;

    @TableField("sync_order_resell_enabled")
    @Schema(description = "定时同步未寄卖订单：1启用 0禁用")
    private Integer syncOrderResellEnabled;

    @TableField("sync_order_unpaid_enabled")
    @Schema(description = "定时同步未支付订单：1启用 0禁用")
    private Integer syncOrderUnpaidEnabled;

    @TableField("sync_order_paid_enabled")
    @Schema(description = "定时同步已支付订单：1启用 0禁用")
    private Integer syncOrderPaidEnabled;

    @TableField("sync_user_enabled")
    @Schema(description = "定时同步用户：1启用 0禁用")
    private Integer syncUserEnabled;

    @TableField("extra_config")
    @Schema(description = "扩展 JSON")
    private String extraConfig;

    @TableField("last_verified_time")
    @Schema(description = "最近连通性探测时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastVerifiedTime;

    @TableField("last_verified_ok")
    @Schema(description = "最近探测结果：1成功 0失败")
    private Integer lastVerifiedOk;

    @TableField("remark")
    @Schema(description = "备注")
    private String remark;

    @TableField("created_by")
    @Schema(description = "创建人")
    private String createdBy;

    @TableField("updated_by")
    @Schema(description = "更新人")
    private String updatedBy;

    @TableField("create_time")
    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @TableField("update_time")
    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    @TableField(exist = false)
    @Schema(description = "是否已配置 Cookie")
    private Boolean cookieConfigured;

    @TableField(exist = false)
    @Schema(description = "是否已配置 PHPSID")
    private Boolean phpsidConfigured;

    @TableField(exist = false)
    @Schema(description = "是否已配置货品 token")
    private Boolean goodsApiTokenConfigured;

    @TableField(exist = false)
    @Schema(description = "是否已配置 appStr")
    private Boolean goodsApiAppStrConfigured;
}
