// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Squidex.Domain.Apps.Core.Apps;
using Squidex.Domain.Apps.Entities.Apps.Commands;
using Squidex.Infrastructure.Collections;
namespace Squidex.Areas.Api.Controllers.Apps.Models
{
public sealed class UpdateAppSettingsDto
{
///
/// The configured app patterns.
///
[Required]
public PatternDto[] Patterns { get; set; }
///
/// The configured UI editors.
///
[Required]
public EditorDto[] Editors { get; set; }
///
/// Hide the scheduler for content items.
///
public bool HideScheduler { get; set; }
///
/// Hide the datetime mode button.
///
public bool HideDateTimeModeButton { get; set; }
public UpdateAppSettings ToCommand()
{
return new UpdateAppSettings
{
Settings = new AppSettings
{
Editors = Editors?.Select(x => x.ToEditor()).ToImmutableList()!,
HideScheduler = HideScheduler,
HideDateTimeModeButton = HideDateTimeModeButton,
Patterns = Patterns?.Select(x => x.ToPattern()).ToImmutableList()!
}
};
}
}
}