using System.Diagnostics.CodeAnalysis;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Shared.Utility;
namespace Content.Client.Stylesheets;
public interface IStyleResources
{
///
/// The file roots of the stylesheet, dictates where assets get read from for the given type of resource.
/// Roots will be checked in order for assets, avoid having a significant number of them.
///
///
/// Must be a constant, changes to this after construction will not be reflected.
///
Dictionary Roots { get; }
///
/// Attempts to locate a resource within the stylesheet's roots.
///
/// The relative path of the target resource.
/// The discovered/cached resource, if any.
/// Type of the resource to read.
/// Whether is null.
bool TryGetResource(ResPath target, [NotNullWhen(true)] out T? resource)
where T : BaseResource, new();
///
/// Retrieves a resource, or throws.
///
/// The relative path of the target resource.
/// Type of the resource to read.
/// The retrieved resource
/// Thrown if the resource does not exist within the stylesheet's roots.
T GetResource(ResPath target)
where T : BaseResource, new();
///
/// Retrieves a resource, or falls back to the specified root. The resource should be present at the fallback
/// root, or else it throws
///
///
/// This should be used to allow common sheetlets to be generic over multiple stylesheets without forcing other
/// styles to have the resource present, if your sheetlet is stylesheet-specific you should not use this.
///
/// The relative path of the target resource.
/// The root that this resource will always exist at
/// Type of the resource to read.
/// The retrieved resource
/// Thrown if the resource does not exist in the fallback root.
T GetResourceOr(ResPath target, ResPath fallbackRoot)
where T : BaseResource, new();
///
/// Attempts to locate a texture within the stylesheet's roots.
///
/// The relative path of the target resource.
/// The retrieved texture, if any.
/// Whether is null.
bool TryGetTexture(ResPath target, [NotNullWhen(true)] out Texture? texture);
///
/// Retrieves a texture, or throws.
///
/// The relative path of the target texture.
/// The retrieved texture
/// Thrown if the texture does not exist within the stylesheet's roots.
Texture GetTexture(ResPath target);
///
/// Retrieves a texture, or falls back to the specified root. The resource should be present at the fallback
/// root, or else it throws
///
///
/// This should be used to allow common sheetlets to be generic over multiple stylesheets without forcing other
/// styles to have the resource present, if your sheetlet is stylesheet-specific you should not use this.
///
/// The relative path of the target texture.
/// The root that this resource will always exist at
/// The retrieved texture
/// Thrown if the texture does not exist in the fallback root.
Texture GetTextureOr(ResPath target, ResPath fallbackRoot);
}