package com.reading.platform.entity;

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

import java.time.LocalDateTime;

/**
 * 产品套餐实体
 * 商业套餐，可包含多个课程包
 */
@Data
@TableName("t_product_bundle")
@Schema(description = "产品套餐")
public class ProductBundle {

    @Schema(description = "套餐 ID", accessMode = Schema.AccessMode.READ_ONLY)
    @TableId(type = IdType.ASSIGN_ID)
    private String id;

    // === 基础信息 ===
    @Schema(description = "套餐名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小班全年套餐")
    private String name;

    @Schema(description = "套餐描述", example = "适合小班幼儿的全年语言领域套餐")
    private String description;

    @Schema(description = "封面图片 URL")
    private String coverUrl;

    // === 价格字段（单位：分） ===
    @Schema(description = "价格（分）", example = "9900")
    private Integer price;

    @Schema(description = "优惠价（分）")
    private Integer discountPrice;

    @Schema(description = "优惠类型：PERCENT-折扣/FIXED-立减")
    private String discountType;

    // === 适用年级 ===
    @Schema(description = "适用年级（JSON 数组）", example = "[\"小班\",\"中班\",\"大班\"]")
    private String gradeLevels;

    // === 状态字段 ===
    @Schema(description = "状态", allowableValues = {"DRAFT", "PENDING_REVIEW", "APPROVED", "REJECTED", "PUBLISHED", "OFFLINE"})
    private String status;

    @Schema(description = "课程包数量")
    private Integer coursePackageCount;

    @Schema(description = "使用学校数")
    private Integer tenantCount;

    @Schema(description = "发布时间")
    private LocalDateTime publishedAt;

    // === 系统字段 ===
    @Schema(description = "是否系统套餐 0-否 1-是", example = "0")
    private Integer isSystem;

    @Schema(description = "创建人用户名", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT)
    private String createdBy;

    @Schema(description = "更新人用户名", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updatedBy;

    @Schema(description = "创建时间", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    @Schema(description = "更新时间", accessMode = Schema.AccessMode.READ_ONLY)
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedAt;

    @Schema(description = "是否删除 0-未删除 1-已删除", accessMode = Schema.AccessMode.READ_ONLY)
    @TableLogic
    private Integer deleted;

    // === 关联关系（多对多） ===
    @TableField(exist = false)
    private java.util.List<ProductBundleCoursePackage> bundleCoursePackages;
}
