using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
namespace Abp.Notifications
{
///
/// A notification distributed to it's related tenant.
///
[Table("AbpTenantNotifications")]
public class TenantNotificationInfo : CreationAuditedEntity, IMayHaveTenant
{
///
/// Tenant id of the subscribed user.
///
public virtual int? TenantId { get; set; }
///
/// Unique notification name.
///
[Required]
[StringLength(NotificationInfo.MaxNotificationNameLength)]
public virtual string NotificationName { get; set; }
///
/// Notification data as JSON string.
///
[StringLength(NotificationInfo.MaxDataLength)]
public virtual string Data { get; set; }
///
/// Type of the JSON serialized .
/// It's AssemblyQualifiedName of the type.
///
[StringLength(NotificationInfo.MaxDataTypeNameLength)]
public virtual string DataTypeName { get; set; }
///
/// Gets/sets entity type name, if this is an entity level notification.
/// It's FullName of the entity type.
///
[StringLength(NotificationInfo.MaxEntityTypeNameLength)]
public virtual string EntityTypeName { get; set; }
///
/// AssemblyQualifiedName of the entity type.
///
[StringLength(NotificationInfo.MaxEntityTypeAssemblyQualifiedNameLength)]
public virtual string EntityTypeAssemblyQualifiedName { get; set; }
///
/// Gets/sets primary key of the entity, if this is an entity level notification.
///
[StringLength(NotificationInfo.MaxEntityIdLength)]
public virtual string EntityId { get; set; }
///
/// Notification severity.
///
public virtual NotificationSeverity Severity { get; set; }
public TenantNotificationInfo()
{
}
public TenantNotificationInfo(Guid id, int? tenantId, NotificationInfo notification)
{
Id = id;
TenantId = tenantId;
NotificationName = notification.NotificationName;
Data = notification.Data;
DataTypeName = notification.DataTypeName;
EntityTypeName = notification.EntityTypeName;
EntityTypeAssemblyQualifiedName = notification.EntityTypeAssemblyQualifiedName;
EntityId = notification.EntityId;
Severity = notification.Severity;
}
}
}