using e_suite.Database.Core.Extensions;
using e_suite.Database.Core.Models;
using e_suite.Database.Core.Tables.Workflow;
using eSuite.Core.Miscellaneous;

namespace e_suite.API.Common;

public class GetWorkflowTemplateVersion : IGeneralId
{
    public GetWorkflowTemplateVersion()
    {

    }

    public GetWorkflowTemplateVersion(WorkflowVersion workflowVersion)
    {
        Id = workflowVersion.Id;
        Guid = workflowVersion.Guid;
        Deleted = workflowVersion.Deleted;
        ActivityNameTemplate = workflowVersion.ActivityNameTemplate;
        Description = workflowVersion.Description;
        DomainId = workflowVersion.Domain.ToGeneralIdRef()!;
        LastUpdated = workflowVersion.LastUpdated;
        Version = workflowVersion.Version;
        WorkflowId = workflowVersion.Workflow.ToGeneralIdRef()!;
        WorkflowName = workflowVersion.Workflow.Name;
        Tasks = workflowVersion.Tasks;
    }

    public List<TaskDefinition> Tasks { get; set; } = [];

    public string WorkflowName { get; set; } = string.Empty;

    public GeneralIdRef WorkflowId { get; set; } = null!;

    public long Version { get; set; }

    public DateTimeOffset LastUpdated { get; set; }

    public GeneralIdRef DomainId { get; set; } = null!;

    public string Description { get; set; } = string.Empty;

    public string ActivityNameTemplate { get; set; } = string.Empty;

    public bool Deleted { get; set; }

    public long Id { get; set; }
    public Guid Guid { get; set; }
}