using IamService.Domain.SeedWork;

namespace IamService.Domain.Events;

/// <summary>
/// EN: Event when access request is created.
/// VI: Event khi yêu cầu truy cập được tạo.
/// </summary>
public record AccessRequestCreatedEvent(
    Guid RequestId,
    Guid RequesterId,
    string ResourceType,
    Guid ResourceId,
    string RequestedPermission) : IDomainEvent
{
    public DateTime OccurredOn { get; } = DateTime.UtcNow;
}

/// <summary>
/// EN: Event when access request is submitted for approval.
/// VI: Event khi yêu cầu truy cập được gửi để phê duyệt.
/// </summary>
public record AccessRequestSubmittedEvent(
    Guid RequestId,
    Guid RequesterId,
    IReadOnlyList<Guid> ApproverIds) : IDomainEvent
{
    public DateTime OccurredOn { get; } = DateTime.UtcNow;
}

/// <summary>
/// EN: Event when access request is approved.
/// VI: Event khi yêu cầu truy cập được phê duyệt.
/// </summary>
public record AccessRequestApprovedEvent(
    Guid RequestId,
    Guid RequesterId,
    string ResourceType,
    Guid ResourceId,
    string Permission) : IDomainEvent
{
    public DateTime OccurredOn { get; } = DateTime.UtcNow;
}

/// <summary>
/// EN: Event when access request is rejected.
/// VI: Event khi yêu cầu truy cập bị từ chối.
/// </summary>
public record AccessRequestRejectedEvent(
    Guid RequestId,
    Guid RequesterId,
    Guid RejectedByUserId,
    string? Reason) : IDomainEvent
{
    public DateTime OccurredOn { get; } = DateTime.UtcNow;
}

