Files
adas-core/adas-core.Domain/Models/MongoModels/Notice.cs
T
2026-06-26 10:29:23 +02:00

42 lines
1.6 KiB
C#

using MongoDB.Bson;
namespace adas_core.Domain.Models.MongoModels;
/// <summary>
/// Represents a notice, typically used to convey information, alerts, or messages within the application.
/// </summary>
public class Notice
{
public ObjectId Id { get; set; }
public DateTime NoticeDate { get; set; }
public string Description { get; set; } = string.Empty;
public string NoticeType { get; set; } = string.Empty;
public ObjectId DisplayId { get; set; }
public List<StaffInfo>? StaffInfoList { get; set; }
public bool IsFooterEnabled { get; set; } = true;
/// <summary>
/// Returns a string representation of the notice, including the date (only when set), display ID, type, and description.
/// </summary>
/// <returns>A formatted string prefixed with "Notice [" and containing the comma-separated notice details, omitting the date entry when <c>NoticeDate</c> equals <see cref="System.DateTime.MinValue"/>.</returns>
public override string ToString()
{
List<string> items = [];
if (NoticeDate != DateTime.MinValue) items.Add($"Date: {NoticeDate}");
items.Add($"DisplayId : {DisplayId}");
items.Add($"Type: {NoticeType}");
items.Add($"Description: {Description}");
return "Notice [" + string.Join(",", items) + "]";
}
}
/// <summary>
/// Represents a data structure that contains information about a staff member.
/// </summary>
public class StaffInfo
{
public required string Role { get; set; }
public required string Leader { get; set; }
}