// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Squidex.Domain.Apps.Core.Contents;
using Squidex.Domain.Apps.Entities.Apps.Commands;
namespace Squidex.Areas.Api.Controllers.Apps.Models
{
public sealed class UpdateWorkflowDto
{
///
/// The name of the workflow.
///
public string Name { get; set; }
///
/// The workflow steps.
///
[Required]
public Dictionary Steps { get; set; }
///
/// The schema ids.
///
public List SchemaIds { get; set; }
///
/// The initial step.
///
public Status Initial { get; set; }
public UpdateWorkflow ToCommand(Guid id)
{
var workflow = new Workflow(
Initial,
Steps?.ToDictionary(
x => x.Key,
x => x.Value?.ToStep()),
SchemaIds,
Name);
return new UpdateWorkflow { WorkflowId = id, Workflow = workflow };
}
}
}