using Core.DomainObjects.PageSections;
using WeatherForecast.Models.Abstractions;

namespace WeatherForecast.Models.PageSections {

  /// <summary>
  /// 
  /// </summary>
  public class TitleSectionModel : PageSectionModelBase<TitleSection> {

    /// <summary>
    /// 
    /// </summary>
    public MediaAttachmentResponseModel? Image { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public LinkModel? PrimaryLink { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public LinkModel? SecondaryLink { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public string? PostedOnBy { get; set; }

    /// <summary>
    /// 
    /// </summary>
    public TitleSectionModel() { }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="titleSection"></param>
    public TitleSectionModel(TitleSection titleSection) : base(titleSection) {

      //if(titleSection.Image != null)
      //  Image = new ImageModel(titleSection.Image);

      if (titleSection.PrimaryLink != null)
        PrimaryLink = new LinkModel(titleSection.PrimaryLink);

      if (titleSection.SecondaryLink != null)
        PrimaryLink = new LinkModel(titleSection.SecondaryLink);

      if (titleSection.PostedOnBy != null)
        PostedOnBy = titleSection.PostedOnBy;
    }
  }
}
