namespace ChessCubing.Server.Admin;

public sealed class AdminUserSummaryResponse
{
    public string Subject { get; init; } = string.Empty;

    public string Username { get; init; } = string.Empty;

    public string? Email { get; init; }

    public string IdentityDisplayName { get; init; } = string.Empty;

    public string? SiteDisplayName { get; init; }

    public bool IsEnabled { get; init; }

    public bool IsEmailVerified { get; init; }

    public bool HasSiteProfile { get; init; }

    public string? Club { get; init; }

    public string? City { get; init; }

    public string? PreferredFormat { get; init; }

    public DateTime? AccountCreatedUtc { get; init; }

    public DateTime? SiteProfileUpdatedUtc { get; init; }
}

public sealed class AdminUserDetailResponse
{
    public string Subject { get; init; } = string.Empty;

    public string Username { get; init; } = string.Empty;

    public string? Email { get; init; }

    public string? FirstName { get; init; }

    public string? LastName { get; init; }

    public string IdentityDisplayName { get; init; } = string.Empty;

    public bool IsEnabled { get; init; }

    public bool IsEmailVerified { get; init; }

    public DateTime? AccountCreatedUtc { get; init; }

    public bool HasSiteProfile { get; init; }

    public string DisplayName { get; init; } = string.Empty;

    public string? Club { get; init; }

    public string? City { get; init; }

    public string? PreferredFormat { get; init; }

    public string? FavoriteCube { get; init; }

    public string? Bio { get; init; }

    public DateTime? SiteProfileCreatedUtc { get; init; }

    public DateTime? SiteProfileUpdatedUtc { get; init; }
}

public sealed class AdminUpdateUserRequest
{
    public string Username { get; init; } = string.Empty;

    public string? Email { get; init; }

    public string? FirstName { get; init; }

    public string? LastName { get; init; }

    public bool IsEnabled { get; init; }

    public bool IsEmailVerified { get; init; }

    public string? DisplayName { get; init; }

    public string? Club { get; init; }

    public string? City { get; init; }

    public string? PreferredFormat { get; init; }

    public string? FavoriteCube { get; init; }

    public string? Bio { get; init; }
}

public sealed class AdminCreateUserRequest
{
    public string Username { get; init; } = string.Empty;

    public string? Email { get; init; }

    public string Password { get; init; } = string.Empty;

    public string ConfirmPassword { get; init; } = string.Empty;

    public string? FirstName { get; init; }

    public string? LastName { get; init; }

    public bool IsEnabled { get; init; } = true;

    public bool IsEmailVerified { get; init; }

    public string? DisplayName { get; init; }

    public string? Club { get; init; }

    public string? City { get; init; }

    public string? PreferredFormat { get; init; }

    public string? FavoriteCube { get; init; }

    public string? Bio { get; init; }
}

public sealed record AdminIdentityUser(
    string Subject,
    string Username,
    string? Email,
    string? FirstName,
    string? LastName,
    bool IsEnabled,
    bool IsEmailVerified,
    DateTime? CreatedUtc);

public sealed record AdminIdentityUserUpdateRequest(
    string Username,
    string? Email,
    string? FirstName,
    string? LastName,
    bool IsEnabled,
    bool IsEmailVerified);

public sealed record AdminIdentityUserCreateRequest(
    string Username,
    string? Email,
    string Password,
    string? FirstName,
    string? LastName,
    bool IsEnabled,
    bool IsEmailVerified);

public sealed class AdminUserValidationException(string message) : Exception(message);
