using System.Collections.Generic;
using Umbraco.Core.Models;
namespace Umbraco.Web.Macros
{
public class MacroModel
{
///
/// The Macro Id
///
public int Id { get; set; }
///
/// The Macro Name
///
public string Name { get; set; }
///
/// The Macro Alias
///
public string Alias { get; set; }
public string MacroSource { get; set; }
public int CacheDuration { get; set; }
public bool CacheByPage { get; set; }
public bool CacheByMember { get; set; }
public bool RenderInEditor { get; set; }
public string CacheIdentifier { get; set; }
public List Properties { get; } = new List();
public MacroModel()
{ }
public MacroModel(IMacro macro)
{
if (macro == null) return;
Id = macro.Id;
Name = macro.Name;
Alias = macro.Alias;
MacroSource = macro.MacroSource;
CacheDuration = macro.CacheDuration;
CacheByPage = macro.CacheByPage;
CacheByMember = macro.CacheByMember;
RenderInEditor = macro.UseInEditor;
foreach (var prop in macro.Properties)
Properties.Add(new MacroPropertyModel(prop.Alias, string.Empty, prop.EditorAlias));
}
}
}