/*
 * File: ShadowedRealms.Core/Models/Admin/AdminPlayerMessage.cs
 * Created: 2025-11-01
 * Last Modified: 2025-11-01
 * Description: Entity model for admin-player messaging system
 * Last Edit Notes: Complete entity model with kingdom scoping and proper relationships
 */

using System.ComponentModel.DataAnnotations;

namespace ShadowedRealms.Core.Models.Admin
{
    /// <summary>
    /// Represents a message between an admin and a player
    /// </summary>
    public class AdminPlayerMessage
    {
        [Key]
        public long Id { get; set; }

        [Required]
        public int PlayerId { get; set; }

        [Required]
        [MaxLength(450)]
        public int AdminUserId { get; set; }

        [Required]
        public string Message { get; set; } = string.Empty;

        [Required]
        [MaxLength(50)]
        public string MessageType { get; set; } = string.Empty; // Support, Warning, System, Info

        [Required]
        public DateTime SentAt { get; set; } = DateTime.UtcNow;

        [Required]
        public bool IsRead { get; set; } = false;

        [Required]
        public int KingdomId { get; set; }

        // Optional player response
        public string? PlayerResponse { get; set; }

        public DateTime? PlayerResponseAt { get; set; }

        // Admin notes about this message/conversation
        [MaxLength(1000)]
        public string? AdminNotes { get; set; }

        // Message thread support
        public long? ParentMessageId { get; set; }

        // Priority level
        public int Priority { get; set; } = 1; // 1=Low, 2=Normal, 3=High, 4=Urgent

        // Automatic/manual flag
        public bool IsAutomaticMessage { get; set; } = false;

        // Template used (if any)
        [MaxLength(100)]
        public string? TemplateUsed { get; set; }
    }
}