using System.ComponentModel.DataAnnotations;

namespace Fengling.AuthService.Models;

public class AuditLog
{
    [Key]
    public long Id { get; set; }

    [MaxLength(50)]
    [Required]
    public string Operator { get; set; } = string.Empty;

    [MaxLength(50)]
    public string? TenantId { get; set; }

    [MaxLength(20)]
    public string Operation { get; set; } = string.Empty;

    [MaxLength(20)]
    public string Action { get; set; } = string.Empty;

    [MaxLength(50)]
    public string? TargetType { get; set; }

    public long? TargetId { get; set; }

    [MaxLength(100)]
    public string? TargetName { get; set; }

    [MaxLength(50)]
    public string IpAddress { get; set; } = string.Empty;

    [MaxLength(500)]
    public string? Description { get; set; }

    public string? OldValue { get; set; }

    public string? NewValue { get; set; }

    public string? ErrorMessage { get; set; }

    [MaxLength(20)]
    public string Status { get; set; } = "success";

    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
