using e_suite.Database.Core.Models;
using e_suite.Workflow.Core.Enums;
using e_suite.Workflow.Core.Interfaces;
using eSuite.Core.Miscellaneous;

namespace e_suite.Workflow.Core;

public class WorkflowTemplate: IGeneralId
{
    public long Id { get; set; }
    public Guid Guid { get; set; }

    /// <summary>
    /// Name of the workflow as seen by users, must be unique.
    /// </summary>
    public required string Name { get; set; }
}

public class WorkflowVersion : IGeneralId, IWorkflowVersion
{
    public long Id { get; set; }
    public Guid Guid { get; set; }

    public required WorkflowTemplate Template { get; set; }

    public required long Version { get; set; }

    public ICollection<ITask> Tasks { get; } = [];  //Serialise to Json.
    public required IGeneralIdRef Domain { get; set; }
    public WorkflowState CurrentState { get; set; } = WorkflowState.Pending;
    public required string ActivityNameTemplate { get; set; }
    public string Description { get; set; } = string.Empty;

    //Todo can only be on a run-time instance
    //public bool Paused { get; } = false;
    //public async Task OnActivateAsync()
    //{
    //}

    //public async Task OnCompleteAsync()
    //{
    //}
}