using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using Unity.Cloud.Collaborate.Assets;
using Unity.Cloud.Collaborate.UserInterface;
using UnityEditor;
using UnityEngine.UIElements;
namespace Unity.Cloud.Collaborate.Components
{
[UsedImplicitly]
internal class AlertBox : VisualElement
{
///
/// Describes the severity of the alert. Used to set the icon.
///
public enum AlertLevel
{
Info,
Warning,
Alert
}
public const string UssClassName = "alert-box";
public const string IconUssClassName = UssClassName + "__icon";
public const string TextUssClassName = UssClassName + "__text";
public const string ButtonUssClassName = UssClassName + "__button";
static readonly string k_LayoutPath = $"{CollaborateWindow.LayoutPath}/{nameof(AlertBox)}.uxml";
static readonly string k_StylePath = $"{CollaborateWindow.StylePath}/{nameof(AlertBox)}.uss";
readonly Button m_Button;
readonly VisualElement m_Icon;
readonly TextElement m_Text;
// Uss classes to set which icon is displayed.
const string k_UssIconInfo = "icon-info";
const string k_UssIconWarning = "icon-warning";
const string k_UssIconAlert = "icon-alert";
///
/// Queue of alerts to be displayed.
///
readonly SortedSet m_AlertEntryList;
///
/// Initialize the box and hide it.
///
public AlertBox()
{
// Get the layout
AddToClassList(UssClassName);
AssetDatabase.LoadAssetAtPath(k_LayoutPath).CloneTree(this);
styleSheets.Add(AssetDatabase.LoadAssetAtPath(k_StylePath));
// Initialise fields
m_Icon = this.Q(className: IconUssClassName);
m_Text = this.Q(className: TextUssClassName);
m_Button = this.Q