Implement the idea creator and application generator: idea status workflow, social canvas card, grant call windows with 409 when closed, and an LLM-backed idea assistant with offline fallback.
23 lines
765 B
C#
23 lines
765 B
C#
using TarninaHub.Domain.Enums;
|
|
|
|
namespace TarninaHub.Domain.Rules;
|
|
|
|
public static class IdeaWorkflow
|
|
{
|
|
private static readonly IReadOnlyDictionary<IdeaStatus, IdeaStatus[]> Transitions =
|
|
new Dictionary<IdeaStatus, IdeaStatus[]>
|
|
{
|
|
[IdeaStatus.Draft] = [IdeaStatus.Submitted],
|
|
[IdeaStatus.Submitted] = [IdeaStatus.InReview],
|
|
[IdeaStatus.InReview] = [IdeaStatus.Accepted, IdeaStatus.Rejected],
|
|
[IdeaStatus.Accepted] = [],
|
|
[IdeaStatus.Rejected] = [],
|
|
};
|
|
|
|
public static bool CanTransition(IdeaStatus from, IdeaStatus to) =>
|
|
from == to || Transitions[from].Contains(to);
|
|
|
|
public static bool IsTerminal(IdeaStatus status) =>
|
|
Transitions[status].Length == 0;
|
|
}
|