Files
BeWoPlaner/Shared/DataContracts/Feature/AI/AiPromptbausteinFolderDC.cs

156 lines
5.1 KiB
C#

using BS.Shared.DataContracts.Compact;
using BS.Shared.Text;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace BS.Shared.DataContracts.Feature.AI
{
[DataContract]
public class AiPromptbausteinFolderDC : BeWoDataContract
{
[DataMember] public string Title { get; set; }
[DataMember] public string Description { get; set; }
[DataMember] public long? ParentFolderOid { get; set; }
[DataMember] public CompactEmployeeDC Creator { get; set; }
[DataMember] public bool IsPublic { get; set; }
[DataMember] public int Position { get; set; }
[DataMember] public bool IsExpanded { get; set; }
[DataMember] public AiActionType ActionType { get; set; }
[DataMember] public List<AiPromptbausteinFolderDC> SubFolders { get; set; }
[DataMember] public List<AiPromptbausteinPromptDC> SubPrompts { get; set; }
[DataMember] public List<AiPromptbausteinRoutineDC> SubRoutines { get; set; }
[DataMember] public bool CanAddFolder { get; set; }
[DataMember] public bool CanAddPrompt { get; set; }
[DataMember] public bool CanAddRoutine { get; set; }
[DataMember] public bool CanEdit { get; set; }
[DataMember] public bool IsNewFeature { get; set; }
}
public static class PredefinedAiPromptbausteinFolders
{
public static IEnumerable<AiPromptbausteinFolderDC> CreateSubTree(AiActionType aiActionType)
{
var example_node = CreateExampleNode(aiActionType);
example_node.SubPrompts.Add(CreateExamplePrompt(aiActionType));
example_node.SubPrompts.Add(CreateExamplePrompt(aiActionType));
example_node.SubPrompts.Add(CreateExamplePrompt(aiActionType));
var own_bib = CreateOwnBibNode(aiActionType);
own_bib.SubFolders.Add(example_node);
example_node.ParentFolderOid = own_bib.Oid;
//own_bib.SubPrompts.Add(CreateExamplePrompt(aiActionType));
//own_bib.SubPrompts.Add(CreateExamplePrompt(aiActionType));
//own_bib.SubPrompts.Add(CreateExamplePrompt(aiActionType));
//var shared_bib = CreateSharedBibNode(aiActionType);
var public_bib = CreatePublicBibNode(aiActionType);
return new List<AiPromptbausteinFolderDC>() {
own_bib, public_bib
};
}
public static AiPromptbausteinFolderDC CreateRootBibNode(AiActionType aiActionType)
{
var title = AiPromptbausteineTexts.RootBibNodeTitle;
var description = AiPromptbausteineTexts.RootBibNodeDescription;
var node = CreateNode(aiActionType, -51, title, description, null);
return node;
}
public static AiPromptbausteinFolderDC CreateOwnBibNode(AiActionType aiActionType)
{
var title = AiPromptbausteineTexts.OwnBibNodeTitle;
var description = AiPromptbausteineTexts.OwnBibNodeDescription;
var node = CreateNode(aiActionType, -1, title, description, null);
node.CanAddFolder = true;
node.CanAddPrompt = true;
node.CanAddRoutine = true;
return node;
}
public static AiPromptbausteinFolderDC CreatePublicBibNode(AiActionType aiActionType)
{
var title = AiPromptbausteineTexts.PublicBibNodeTitle;
var description = AiPromptbausteineTexts.PublicBibNodeDescription;
var node = CreateNode(aiActionType, -3, title, description, null);
return node;
}
public static AiPromptbausteinFolderDC CreatePublicSharedBibNode(AiActionType aiActionType, string display)
{
var title = string.Format(AiPromptbausteineTexts.PublicSharedBibNodeTitle, display);
var description = string.Format(AiPromptbausteineTexts.PublicSharedBibNodeDescription, display);
var node = CreateNode(aiActionType, -31, title, description, null);
node.IsExpanded = false;
return node;
}
public static AiPromptbausteinFolderDC CreateOwnsoftBibNode(AiActionType aiActionType)
{
var title = AiPromptbausteineTexts.OwnsoftBibNodeTitle;
var description = AiPromptbausteineTexts.OwnsoftBibNodeDescription;
var node = CreateNode(aiActionType, -4, title, description, null);
return node;
}
public static AiPromptbausteinFolderDC CreateExampleNode(AiActionType aiActionType)
{
var node = CreateNode(aiActionType, -100, "Beispiel Ordner", "Beispielbeschreibung", null);
node.CanAddFolder = true;
node.CanAddPrompt = true;
node.CanAddRoutine = true;
node.CanEdit = true;
return node;
}
public static AiPromptbausteinPromptDC CreateExamplePrompt(AiActionType aiActionType)
{
return new AiPromptbausteinPromptDC()
{
Oid = -101,
Description = "Beispielbeschreibung",
Title = "Beispieltitel",
Prompt = "Beispielprompt",
IsOwnsoftPrompt = true,
OwnsoftRefLink = "https://help.bewoplaner.de/"
};
}
public static AiPromptbausteinFolderDC CreateNode(AiActionType aiActionType, long oid, string title, string description, long? parent_folder_oid)
{
return new AiPromptbausteinFolderDC()
{
ActionType = aiActionType,
Description = description,
Oid = oid,
ParentFolderOid = parent_folder_oid,
SubFolders = new List<AiPromptbausteinFolderDC>(),
SubPrompts = new List<AiPromptbausteinPromptDC>(),
SubRoutines = new List<AiPromptbausteinRoutineDC>(),
Title = title,
Version = 1,
CanAddFolder = false,
CanAddPrompt = false,
CanAddRoutine = false,
CanEdit = false,
IsExpanded = true,
};
}
}
}