// Copyright (c) Umbraco. // See LICENSE for more details. using System.ComponentModel.DataAnnotations; using Umbraco.Cms.Core.Configuration.Models.Validation; namespace Umbraco.Cms.Core.Configuration.Models; /// /// Typed configuration for a content error page. /// public class ContentErrorPage : ValidatableEntryBase { /// /// Gets or sets a value for the content Id. /// public int ContentId { get; set; } /// /// Gets or sets a value for the content key. /// public Guid ContentKey { get; set; } /// /// Gets or sets a value for the content XPath. /// [Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")] public string? ContentXPath { get; set; } /// /// Gets a value indicating whether the field is populated. /// public bool HasContentId => ContentId != 0; /// /// Gets a value indicating whether the field is populated. /// public bool HasContentKey => ContentKey != Guid.Empty; /// /// Gets a value indicating whether the field is populated. /// [Obsolete("The current implementation of XPath is suboptimal and will be removed entirely in a future version. Scheduled for removal in v14")] public bool HasContentXPath => !string.IsNullOrEmpty(ContentXPath); /// /// Gets or sets a value for the content culture. /// [Required] public string Culture { get; set; } = null!; internal override bool IsValid() => base.IsValid() && (HasContentId ? 1 : 0) + (HasContentKey ? 1 : 0) + (HasContentXPath ? 1 : 0) == 1; }