using MediatR;
using SocialService.Domain.AggregatesModel.RelationshipAggregate;

namespace SocialService.Domain.Events;

/// <summary>
/// EN: Domain event raised when a friend request is sent.
/// VI: Domain event được raise khi yêu cầu kết bạn được gửi.
/// </summary>
public class FriendRequestSentDomainEvent : INotification
{
    public Relationship Relationship { get; }
    public DateTime OccurredOn { get; }

    public FriendRequestSentDomainEvent(Relationship relationship)
    {
        Relationship = relationship;
        OccurredOn = DateTime.UtcNow;
    }
}

/// <summary>
/// EN: Domain event raised when a friendship is created (request accepted).
/// VI: Domain event được raise khi kết bạn được tạo (yêu cầu được chấp nhận).
/// </summary>
public class FriendshipCreatedDomainEvent : INotification
{
    public Relationship Relationship { get; }
    public DateTime OccurredOn { get; }

    public FriendshipCreatedDomainEvent(Relationship relationship)
    {
        Relationship = relationship;
        OccurredOn = DateTime.UtcNow;
    }
}

/// <summary>
/// EN: Domain event raised when a user follows another user.
/// VI: Domain event được raise khi user theo dõi user khác.
/// </summary>
public class UserFollowedDomainEvent : INotification
{
    public Relationship Relationship { get; }
    public DateTime OccurredOn { get; }

    public UserFollowedDomainEvent(Relationship relationship)
    {
        Relationship = relationship;
        OccurredOn = DateTime.UtcNow;
    }
}

/// <summary>
/// EN: Domain event raised when a relationship status changes.
/// VI: Domain event được raise khi trạng thái quan hệ thay đổi.
/// </summary>
public class RelationshipStatusChangedDomainEvent : INotification
{
    public Guid RelationshipId { get; }
    public RelationshipStatus PreviousStatus { get; }
    public RelationshipStatus NewStatus { get; }
    public DateTime OccurredOn { get; }

    public RelationshipStatusChangedDomainEvent(
        Guid relationshipId,
        RelationshipStatus previousStatus,
        RelationshipStatus newStatus)
    {
        RelationshipId = relationshipId;
        PreviousStatus = previousStatus;
        NewStatus = newStatus;
        OccurredOn = DateTime.UtcNow;
    }
}

/// <summary>
/// EN: Domain event raised when a relationship is removed (unfriend/unfollow).
/// VI: Domain event được raise khi quan hệ bị xóa (hủy kết bạn/hủy theo dõi).
/// </summary>
public class RelationshipRemovedDomainEvent : INotification
{
    public Relationship Relationship { get; }
    public DateTime OccurredOn { get; }

    public RelationshipRemovedDomainEvent(Relationship relationship)
    {
        Relationship = relationship;
        OccurredOn = DateTime.UtcNow;
    }
}
