using Microsoft.AspNetCore.Components.Routing;
using Microsoft.FluentUI.AspNetCore.Components;
namespace HopFrame.Web.Models;
public sealed class CustomView {
public required string Name { get; init; }
public string? Description { get; set; }
public string? Policy { get; set; }
public required string Url { get; init; }
public string Icon { get; set; } = "Window";
public NavLinkMatch LinkMatch { get; set; } = NavLinkMatch.All;
}
public sealed class CustomViewConfigurator(CustomView view) {
public CustomView InnerConfig { get; } = view;
///
/// Sets the description displayed in the dashboard
///
/// The desired description
public CustomViewConfigurator SetDescription(string description) {
InnerConfig.Description = description;
return this;
}
///
/// Sets the policy needed in order to access the view
///
/// The desired policy
public CustomViewConfigurator SetPolicy(string policy) {
InnerConfig.Policy = policy;
return this;
}
///
/// Sets the icon displayed in the sidebar
///
/// The desired fluent-icon
public CustomViewConfigurator SetIcon(string icon) {
InnerConfig.Icon = icon;
return this;
}
///
/// Sets the rule for the sidebar to determine if the link is active
///
/// The desired match rule
public CustomViewConfigurator SetLinkMatch(NavLinkMatch match) {
InnerConfig.LinkMatch = match;
return this;
}
}