using System;
using JetBrains.Annotations;
using Unity.Cloud.Collaborate.Models.Api;
using Unity.Cloud.Collaborate.Models.Enums;
using Unity.Cloud.Collaborate.UserInterface;
using UnityEngine;
namespace Unity.Cloud.Collaborate.Models
{
internal class StartModel : IStartModel
{
[NotNull]
readonly ISourceControlProvider m_Provider;
///
public event Action ProjectStatusChanged;
///
public event Action StateChanged;
public StartModel([NotNull] ISourceControlProvider provider)
{
m_Provider = provider;
}
///
public void OnStart()
{
m_Provider.UpdatedProjectStatus += OnUpdatedProjectStatus;
}
///
public void OnStop()
{
m_Provider.UpdatedProjectStatus -= OnUpdatedProjectStatus;
}
///
public void RestoreState(IWindowCache cache)
{
StateChanged?.Invoke();
}
///
public void SaveState(IWindowCache cache)
{
}
///
public ProjectStatus ProjectStatus => m_Provider.GetProjectStatus();
///
public void RequestTurnOnService()
{
m_Provider.RequestTurnOnService();
}
///
public void ShowServicePage()
{
m_Provider.ShowServicePage();
}
///
public void ShowLoginPage()
{
m_Provider.ShowLoginPage();
}
///
public void ShowNoSeatPage()
{
m_Provider.ShowNoSeatPage();
}
void OnUpdatedProjectStatus(ProjectStatus status)
{
ProjectStatusChanged?.Invoke(status);
}
}
}