using System.ComponentModel.DataAnnotations;
namespace DorkNet.Server.Data.Entities;
///
/// IP-level ban for blocking misbehaving traffic before the JWT-based
/// player ban can apply. Checked by IpBanCheckMiddleware ahead
/// of authentication; matching requests get a 403.
///
/// CIDR notation lets a single row block a /24 or /32. The expiry is
/// optional — null means "permanent until manually removed".
///
public class IpBanEntity
{
public long Id { get; set; }
/// CIDR or single-IP string (1.2.3.4 or 1.2.3.0/24).
/// Compared against HttpContext.Connection.RemoteIpAddress.
[MaxLength(64)]
public string Cidr { get; set; } = string.Empty;
[MaxLength(512)]
public string Reason { get; set; } = string.Empty;
public long BannedByAdminId { get; set; }
public DateTime BannedAt { get; set; } = DateTime.UtcNow;
/// Null = permanent.
public DateTime? Until { get; set; }
}