using System;
using System.Collections.Generic;
using System.Text;
namespace Edge.Core.Configuration
{
public enum ConfigValueType
{
// most likely the json or xml content.
PlainText,
// saved as base 64 string for binary.
File
}
public class ConfigDescription
{
///
/// Unique id for a config.
///
public Guid ConfigId { get; set; }
///
/// the owner id of the config, could be a BusinessUnit Guid or Device's SerialNumber
///
public string OwnerId { get; set; }
///
/// the type of the config
///
public ConfigValueType ValueType { get; set; }
///
/// Name of the config
///
public string Name { get; set; }
public bool Enabled { get; set; }
///
/// user friendly message for help understand the purpose of this config
///
public string Description { get; set; }
///
/// Created server time
///
public DateTime CreatedTime { get; set; }
public IEnumerable ConfigFileDescriptions { get; set; }
///
/// MD5 hash for concrete config value, used to detect if a config had been changed.
///
public string ValueMD5 { get; set; }
public string GroupName { get; set; }
}
public class ConfigFileDescription
{
public Guid Id { get; set; }
public virtual string Name { get; set; }
///
/// Original full file name, like abcd.txt
///
public virtual string FullName { get; set; }
public virtual long Length { get; set; }
public virtual string ContentHash { get; set; }
public DateTime CreatedServerTime { get; set; }
}
public class Configuration
{
public Guid Id { get; set; }
///
/// Gets or sets the owner id who owns this configuration value.
/// could be a Device, or a BusinessUnit, then this value could be a DeviceSerialNumber, or a BU's guid.
///
public string OwnerId { get; set; }
public ConfigValueType ValueType { get; set; }
///
/// Gets or sets the name of this configuration, unique for each Owner
///
public string Name { get; set; }
public virtual Guid? GroupId { get; set; }
public string Description { get; set; }
///
/// Gets or sets if enable this configuration.
///
public bool Enabled { get; set; }
///
/// --!!!!!!---> IF xml content, make sure no space between nodes
/// Gets or sets the concreate configuration values,
/// Use base64 encode string for faciliates the binary content.
/// or json(xml) for other cases.
///
public string Value { get; set; }
public virtual List Files { get; set; }
public DateTime CreatedServerTime { get; set; }
public virtual Guid CreatedByUser { get; set; }
}
public class ConfigurationFile
{
public Guid Id { get; set; }
public virtual Guid ConfigurationId { get; set; }
public virtual Configuration Configuration { get; set; }
public virtual string Name { get; set; }
///
/// Original full file name, like abcd.txt
///
public virtual string FullName { get; set; }
public virtual long Length { get; set; }
public virtual string ContentHash { get; set; }
public virtual byte[] Value { get; set; }
public DateTime CreatedServerTime { get; set; }
}
}