using Microsoft.AspNetCore.Identity;

namespace Jiaowu.Api.Domain.Identity;

public sealed class ApplicationUser : IdentityUser<Guid>
{
    public required string DisplayName { get; set; }
    public string? StaffNumber { get; set; }
    public Guid? CollegeId { get; set; }
    public bool IsEnabled { get; set; } = true;
    public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
    public DateTime? LastLoginAt { get; set; }
    public string? CalendarSubscriptionStamp { get; set; }
    public DateTime? CalendarSubscriptionCreatedAt { get; set; }
}

public sealed class ApplicationRole : IdentityRole<Guid>
{
    public string? Description { get; set; }
    public DataScope DataScope { get; set; } = DataScope.Self;
}

public enum DataScope
{
    Self = 0,
    Class = 1,
    College = 2,
    All = 3
}

public static class SystemRoles
{
    public const string SuperAdmin = "SuperAdmin";
    public const string AcademicAdmin = "AcademicAdmin";
    public const string CollegeAdmin = "CollegeAdmin";
    public const string Teacher = "Teacher";
    public const string Counselor = "Counselor";
    public const string Student = "Student";
    public const string Leader = "Leader";

    public static readonly string[] All =
    [
        SuperAdmin,
        AcademicAdmin,
        CollegeAdmin,
        Teacher,
        Counselor,
        Student,
        Leader
    ];
}
