Files
2026-08-05 21:15:15 +03:00

55 lines
1.5 KiB
C#

using System;
namespace Chat.Domain.Entities;
/// <summary>
/// Represents a direct messaging conversation between two users.
/// </summary>
public class Conversation
{
/// <summary>
/// Unique identifier for the conversation.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Foreign key to the first participant (User).
/// </summary>
public Guid Participant1Id { get; set; }
/// <summary>
/// Foreign key to the second participant (User).
/// </summary>
public Guid Participant2Id { get; set; }
/// <summary>
/// Date and time when the conversation was created.
/// </summary>
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
/// <summary>
/// Foreign key to the last message in the conversation. Can be null if no messages exist.
/// </summary>
public Guid? LastMessageId { get; set; }
/// <summary>
/// Date and time when the last message was sent in the conversation.
/// </summary>
public DateTime? LastMessageAt { get; set; }
/// <summary>
/// Number of unread messages for participant 1.
/// </summary>
public int UnreadCount1 { get; set; } = 0;
/// <summary>
/// Number of unread messages for participant 2.
/// </summary>
public int UnreadCount2 { get; set; } = 0;
// Navigation properties (to User and Message entities when they exist)
// public User Participant1 { get; set; }
// public User Participant2 { get; set; }
// public Message LastMessage { get; set; }
}