package com.gxwebsoft.common.system.entity;

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

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

/**
 * 租户订阅记录
 *
 * @author WebSoft
 * @since 2025-12-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Schema(name = "TenantSubscription对象", description = "租户订阅记录")
@TableName("sys_tenant_subscription")
public class TenantSubscription implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "订阅ID")
    @TableId(value = "subscription_id", type = IdType.AUTO)
    private Long subscriptionId;

    @Schema(description = "租户ID")
    private Integer tenantId;

    @Schema(description = "当前套餐ID")
    private Integer packageId;

    @Schema(description = "套餐名称")
    private String packageName;

    @Schema(description = "当前版本")
    private Integer version;

    @Schema(description = "开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date startTime;

    @Schema(description = "到期时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime;

    @Schema(description = "是否试用期")
    private Integer isTrial;

    @Schema(description = "是否已过期 0否 1是")
    private Integer isExpired;

    @Schema(description = "自动续费 0关闭 1开启")
    private Integer autoRenewal;

    @Schema(description = "续费套餐ID")
    private Integer renewalPackageId;

    @Schema(description = "提醒状态 0未提醒 1已提醒30天 2已提醒7天 3已提醒1天")
    private Integer notifyStatus;

    @Schema(description = "状态 0停用 1正常")
    private Integer status;

    @Schema(description = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @Schema(description = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    // 关联查询字段
    @Schema(description = "套餐信息")
    @TableField(exist = false)
    private TenantPackage tenantPackage;

    @Schema(description = "租户信息")
    @TableField(exist = false)
    private Tenant tenant;
}
