using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Jellyfin.Plugin.SSO_Auth.Api;
namespace Jellyfin.Plugin.SSO_Auth.State;
///
/// Stores the in-flight OpenID authorization states of a login or linking flow.
///
public interface ISsoStateStore
{
///
/// Stores a newly prepared authorization state.
///
/// The state to store, keyed on its OpenID state value.
/// How long the state remains usable.
/// A task representing the write.
Task CreateAsync(TimedAuthorizeState state, TimeSpan expiry);
///
/// Reads an authorization state without removing it.
///
/// The OpenID state value.
/// The stored state, or null when it is unknown or expired.
Task GetAsync(string state);
///
/// Persists mutations made to an authorization state and refreshes its expiry.
///
/// The state to persist, keyed on its OpenID state value.
/// How long the state remains usable.
/// A task representing the write.
Task UpdateAsync(TimedAuthorizeState state, TimeSpan expiry);
///
/// Reads an authorization state and removes it in the same operation, so it can only be redeemed once.
///
/// The OpenID state value.
/// The stored state, or null when it is unknown, expired or already redeemed.
Task ConsumeAsync(string state);
///
/// Lists every authorization state currently in flight.
///
/// The states in flight.
Task> ListAsync();
}