PlotDirector/PlotLine/Services/NameOccurrenceNavigation.cs

11 lines
884 B
C#

using PlotLine.Models;
namespace PlotLine.Services;
public static class NameOccurrenceNavigation
{
public static string Url(NameOccurrenceReference reference)=>reference.ParagraphID is {} paragraph?$"/manuscript/paragraphs?bookId={reference.BookID}&paragraphId={paragraph:D}#paragraph-{paragraph:D}":reference.SceneID is {} scene?$"/Scenes/Edit/{scene}":reference.ChapterID is {} chapter?$"/Chapters/Edit/{chapter}":$"/Books/Details/{reference.BookID}";
}
public sealed record AiQuotePresentation(bool Allowed,bool Entitled,string Name,int? Cost,int Remaining,DateTime Renewal,string Message,string UpgradeUrl)
{
public static AiQuotePresentation From(AiOperationQuote quote,string upgrade)=>new(quote.CanExecute,quote.Entitled,quote.Operation?.DisplayName??"AI operation",quote.Operation?.CreditCost,quote.Allowance.Remaining,quote.Allowance.PeriodEndUtc,quote.Message,upgrade);
}