using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Oqtane.Models
{
///
/// An Alias maps a url like `oqtane.my` or `oqtane.my/products` to a and
///
public class Alias : IAuditable
{
///
/// The primary ID for internal use. It's also used in API calls to identify the site.
///
public int AliasId { get; set; }
///
/// The Alias Name = URL.
/// The Name contains the entire path - so it can be `oqtane.me`, `www.oqtane.me` or `oqtane.me/products`
///
public string Name { get; set; }
///
/// The Tenant this Alias (and the Site) references.
/// It's important, as anything related to the Alias must be requested from a database, which is found by the Tenant it's in.
///
public int TenantId { get; set; }
///
/// The Site this Alias references.
///
public int SiteId { get; set; }
///
public string CreatedBy { get; set; }
///
public DateTime CreatedOn { get; set; }
///
public string ModifiedBy { get; set; }
///
public DateTime ModifiedOn { get; set; }
///
/// todoc - unclear what this is for
///
[NotMapped]
public DateTime SyncDate { get; set; }
///
/// todoc - unclear what this is for
///
[NotMapped]
public List SyncEvents { get; set; }
///
/// The path contains the url-part after the first slash.
/// * If the Name is `oqtane.me` the Path is empty
/// * if the Name is `oqtane.me/products` the Path is `products`
///
[NotMapped]
public string Path
{
get
{
if (Name.Contains("/"))
{
return Name.Substring(Name.IndexOf("/") + 1);
}
else
{
return "";
}
}
}
}
}