using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Core.Enum;
//
// This is here so CodeMaid doesn't reorganize this document
//
namespace LiMan.DB.DTO
{
public class ReleaseDTO
{
///
/// Codice/Nome applicativo
///
public string CodApp { get; set; } = "";
///
/// Versione applicativo formato semver numerico 4 blocchi
///
public string VersNum { get; set; } = "0.0.0.0";
///
/// Versione applicativo, formato testuale libero, può essere uguale a VersNum
///
public string VersText { get; set; } = "a.b";
///
/// Oggetto versione calcolato da VersNum
///
public Version VersVal { get; set; } = new Version();
///
/// Verifica se sia permessa la versione quando viene valutata la versione massima consentita
///
public bool IsPermitted { get; set; } = false;
///
/// Data di release
///
public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100);
///
/// Tag associati a versione, comma separated
///
public string RelTags { get; set; } = "";
///
/// Url pagina web di changelog (traduzione gestita sul sito target) - calcolato da CodApp + vers
///
//public string UrlChangelog { get; set; } = "http://releases.egalware.com";
[NotMapped]
public string UrlChangelog
{
get => $"https://releases.egalware.com/{CodApp}/{VersText}".ToLower();
}
///
/// Url pagina web di changelog estesa (traduzione gestita sul sito target) - calcolato da CodApp + vers
///
//public string UrlChangelogExt { get; set; } = "http://releases.egalware.com";
[NotMapped]
public string UrlChangelogExt
{
get => $"https://releases.egalware.com/ext_{CodApp}/{VersText}".ToLower();
}
///
/// Attivo/Pubblico (qui calcolato, attivo se la data di release è passata, poi potrebbe essere gestito a parte da DB)
///
[NotMapped]
public bool IsActive
{
get => (DateTime.Today.Subtract(ReleaseDate).TotalDays >= 0);
}
}
}