using Core.Abstractions;
using Core.Abstractions.Models;
using Core.DomainObjects.L10n;
using Core.Enumerations;
namespace WeatherForecast.Models.L10n {
///
///
///
public class PostItemL10nModel : ModelBase {
///
///
///
public string Locale { get; set; }
///
///
///
public string Slug { get; set; }
///
///
///
public string Description { get; set; }
///
///
///
public string Title { get; set; }
///
///
///
public string ShortText { get; set; }
///
///
///
public string Text { get; set; }
///
///
///
public string PlainText { get; set; }
///
///
///
public string ContentType { get; set; }
///
///
///
public List? Badges { get; set; }
///
///
///
public PostItemL10nModel() { }
///
///
///
///
public PostItemL10nModel(PostItemL10n postItemL10n) {
Locale = postItemL10n.Locale.Name;
Slug = postItemL10n.Slug;
Description = postItemL10n.Description;
Title = postItemL10n.Title;
ShortText = postItemL10n.ShortText;
Text = postItemL10n.Text;
ContentType = postItemL10n.ContentType.Name;
Badges = postItemL10n.Badges;
}
///
///
///
///
public PostItemL10n ToDomainObject() => new() {
Locale = Enumeration.FromDisplayName(Locale),
Slug = Slug,
Description = Description,
Title = Title,
Text = Text,
ShortText = ShortText,
// TODO: create plain text creation logic
PlainText = "TODO",
ContentType = Enumeration.FromDisplayName(ContentType),
Badges = Badges
};
}
}