// ==========================================================================
// DateTimeFieldPropertiesDto.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using NJsonSchema.Annotations;
using NodaTime;
using Squidex.Domain.Apps.Core.Schemas;
using Squidex.Infrastructure.Reflection;
namespace Squidex.Areas.Api.Controllers.Schemas.Models.Fields
{
[JsonSchema("DateTime")]
public sealed class DateTimeFieldPropertiesDto : FieldPropertiesDto
{
///
/// The default value for the field value.
///
public Instant? DefaultValue { get; set; }
///
/// The maximum allowed value for the field value.
///
public Instant? MaxValue { get; set; }
///
/// The minimum allowed value for the field value.
///
public Instant? MinValue { get; set; }
///
/// The editor that is used to manage this field.
///
[JsonConverter(typeof(StringEnumConverter))]
public DateTimeFieldEditor Editor { get; set; }
///
/// The calculated default value for the field value.
///
[JsonConverter(typeof(StringEnumConverter))]
public DateTimeCalculatedDefaultValue? CalculatedDefaultValue { get; set; }
public override FieldProperties ToProperties()
{
var result = SimpleMapper.Map(this, new DateTimeFieldProperties());
return result;
}
}
}