package shop.alien.entity.store;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * 推送渠道配置表
 */
@Data
@JsonInclude
@TableName("common_push_channel_config")
@ApiModel(value = "CommonPushChannelConfig", description = "推送渠道配置表")
public class CommonPushChannelConfig implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty("渠道编码，唯一：apns/huawei/xiaomi/oppo/vivo/honor")
    @TableField("channel_code")
    private String channelCode;

    @ApiModelProperty("渠道显示名称")
    @TableField("channel_name")
    private String channelName;

    @ApiModelProperty("平台：iOS/Android")
    @TableField("platform")
    private String platform;

    @ApiModelProperty("渠道开关：0-禁用 1-启用")
    @TableField("enable")
    private Integer enable;

    @ApiModelProperty("并发优先级：P1/P2/P3，数字越小优先级越高")
    @TableField("priority_level")
    private String priorityLevel;

    @ApiModelProperty("每日发送配额上限，0表示不限")
    @TableField("daily_quota")
    private Integer dailyQuota;

    @ApiModelProperty("厂商凭证JSON（BundleID、TeamID、AuthKey等）")
    @TableField("credential_json")
    private String credentialJson;

    @ApiModelProperty("今日已用推送数")
    @TableField("today_usage")
    private Integer todayUsage;

    @ApiModelProperty("送达成功率百分比")
    @TableField("success_rate")
    private BigDecimal successRate;

    @ApiModelProperty("证书过期时间（仅APNs）")
    @TableField("cert_expire_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date certExpireTime;

    @ApiModelProperty("最近连通性测试时间")
    @TableField("last_test_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastTestTime;

    @ApiModelProperty("在线状态：0-离线 1-在线")
    @TableField("connect_status")
    private Integer connectStatus;

    @ApiModelProperty("告警信息（如配额预警）")
    @TableField("warn_msg")
    private String warnMsg;

    @ApiModelProperty("删除标记，0:未删除，1:已删除")
    @TableField("delete_flag")
    @TableLogic
    private Integer deleteFlag;

    @ApiModelProperty("创建时间")
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;

    @ApiModelProperty("创建人ID")
    @TableField("created_user_id")
    private Integer createdUserId;

    @ApiModelProperty("修改时间")
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updatedTime;

    @ApiModelProperty("修改人ID")
    @TableField("updated_user_id")
    private Integer updatedUserId;
}
