using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace HoneyBox.Model.Entities;

/// <summary>
/// 用户海报缓存实体
/// </summary>
[Table("user_poster_cache")]
public class UserPosterCache
{
    [Key]
    [Column("id")]
    public int Id { get; set; }

    /// <summary>
    /// 用户ID
    /// </summary>
    [Column("user_id")]
    public int UserId { get; set; }

    /// <summary>
    /// 小程序AppId
    /// </summary>
    [Column("app_id")]
    [StringLength(100)]
    public string? AppId { get; set; }

    /// <summary>
    /// 模板文件哈希值
    /// </summary>
    [Column("template_hash")]
    [StringLength(64)]
    public string TemplateHash { get; set; } = string.Empty;

    /// <summary>
    /// COS存储URL
    /// </summary>
    [Column("cos_url")]
    [StringLength(500)]
    public string CosUrl { get; set; } = string.Empty;

    /// <summary>
    /// 文件大小（字节）
    /// </summary>
    [Column("file_size")]
    public long FileSize { get; set; }

    /// <summary>
    /// MIME类型
    /// </summary>
    [Column("mime_type")]
    [StringLength(50)]
    public string MimeType { get; set; } = "image/png";

    /// <summary>
    /// 状态：1有效 0无效
    /// </summary>
    [Column("status")]
    public int Status { get; set; } = 1;

    /// <summary>
    /// 过期时间
    /// </summary>
    [Column("expires_at")]
    public DateTime ExpiresAt { get; set; }

    /// <summary>
    /// 平台类型：MP-WEIXIN/H5/APP等
    /// </summary>
    [Column("platform")]
    [StringLength(50)]
    public string Platform { get; set; } = "MP-WEIXIN";

    /// <summary>
    /// 创建时间
    /// </summary>
    [Column("created_at")]
    public DateTime CreatedAt { get; set; } = DateTime.Now;

    /// <summary>
    /// 更新时间
    /// </summary>
    [Column("updated_at")]
    public DateTime UpdatedAt { get; set; } = DateTime.Now;
}
 