using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace AsbCloudDb.Model;

[Table("t_notification"), Comment("Уведомления")]
public class Notification : IId
{
   [Key]
   [Column("id")]
   public int Id { get; set; }
   
   [Column("id_user"), Comment("Id получателя")]
   public int IdUser { get; set; }

   [Column("id_notification_category"), Comment("Id категории уведомления")]
   public int IdNotificationCategory { get; set; }

   [Column("title"), Comment("Заголовок уведомления")]
   public string Title { get; set; } = null!;

   [Column("message"), Comment("Сообщение уведомления")]
   public string Message { get; set; } = null!;

   [Column("registration_date"), Comment("Дата регистрации уведомления")]
   public DateTimeOffset RegistrationDate { get; set; }

   [Column("sent_date"), Comment("Дата отправки уведомления")]
   public DateTimeOffset? SentDate { get; set; }
   
   [Column("read_date"), Comment("Дата прочтения уведомления")]
   public DateTimeOffset? ReadDate { get; set; }
   
   [Column("id_transport_type"), Comment("Id типа доставки уведомления")]
   public int IdTransportType { get; set; }

   [ForeignKey(nameof(IdNotificationCategory))]
   public virtual NotificationCategory NotificationCategory { get; set; } = null!;
   
   [ForeignKey(nameof(IdUser))]
   public virtual User User { get; set; } = null!;
}