using Umbraco.Cms.Core.Models.PublishedContent;
namespace Umbraco.Cms.Core.Routing;
///
/// Routes requests.
///
public interface IPublishedRouter
{
///
/// Creates a published request.
///
/// The current request Uri.
/// A published request builder.
Task CreateRequestAsync(Uri uri);
///
/// Sends a through the routing pipeline and builds a result.
///
/// The request.
/// The options.
/// The built instance.
Task RouteRequestAsync(IPublishedRequestBuilder request, RouteRequestOptions options);
///
/// Updates the request to use the specified item, or NULL
///
/// The request.
/// The published content.
///
///
/// A new based on values from the original
/// and with the re-routed values based on the passed in
///
///
/// This method is used for 2 cases:
/// - When the rendering content needs to change due to Public Access rules.
/// - When there is nothing to render due to circumstances such as no template files. In this case, NULL is used as the parameter.
///
///
/// This method is invoked when the pipeline decides it cannot render
/// the request, for whatever reason, and wants to force it to be re-routed
/// and rendered as if no document were found (404).
/// This occurs if there is no template found and route hijacking was not matched.
/// In that case it's the same as if there was no content which means even if there was
/// content matched we want to run the request through the last chance finders.
///
///
Task UpdateRequestAsync(IPublishedRequest request, IPublishedContent? publishedContent);
///
/// Finds the site root (if any) matching the http request, and updates the PublishedRequest and VariationContext accordingly.
///
///
/// This method is used for VirtualPage routing.
///
///
/// In this case we do not want to run the entire routing pipeline since ContentFinders are not needed here.
/// However, we do want to set the culture on VariationContext and PublishedRequest to the values specified by the domains.
///
///
///
/// The request to update the culture on domain on
/// True if a domain was found otherwise false.
bool RouteDomain(IPublishedRequestBuilder request) => false;
///
/// Finds the site root (if any) matching the http request, and updates the VariationContext accordingly.
///
///
///
/// This is used for VirtualPage routing.
///
///
/// This is required to set the culture on VariationContext to the values specified by the domains, before the FindContent method is called.
/// In order to allow the FindContent implementer to correctly find content based off the culture. Before the PublishedRequest is built.
///
///
/// The URI to resolve the domain from.
/// True if a domain was found, otherwise false.
bool UpdateVariationContext(Uri uri) => false;
}