14 lines
1006 B
C#
14 lines
1006 B
C#
using PlotLine.Models.Investigations;
|
|
namespace PlotLine.Services.Investigations;
|
|
// Trusted authenticated adapters only. Catalogue data never supplies a URL or a controller name.
|
|
public static class DestinationRegistry
|
|
{
|
|
public static readonly HashSet<string> Resolvers=["Write","Characters","PlotThreads","Timeline","Relationships","Review"];
|
|
public static (string Controller,string Action,object Values)? Resolve(Capability d,int project,int book,bool authorised,IReadOnlyDictionary<string,Answer> answers)
|
|
{
|
|
if(!authorised||!d.Available||project<=0||d.RequiresBook&&book<=0||!InvestigationEngine.Allows(d.Prerequisites,answers))return null;
|
|
var controller=d.Resolver switch{"Write"=>"Writer","Characters"=>"Characters","PlotThreads"=>"PlotLineWorkspace","Timeline"=>"Timeline","Relationships"=>"RelationshipMap","Review"=>"Writer",_=>null};
|
|
return controller==null?null:(controller,controller=="Writer"?(d.Resolver=="Review"?"Review":"Write"):"Index",new{projectId=project,bookId=book});
|
|
}
|
|
}
|