package dev.lions.events;

import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Événement émis lors de la modification ou création d'un projet. Permet de gérer les mises à jour
 * asynchrones (cache, indexation, etc.).
 */
@Getter
@AllArgsConstructor
public class ProjectUpdateEvent {
  private final String projectId;
  private final String action; // CREATE, UPDATE, DELETE
  private final LocalDateTime timestamp;

  public ProjectUpdateEvent(String projectId, String action) {
    this.projectId = projectId;
    this.action = action;
    this.timestamp = LocalDateTime.now();
  }

  public boolean isCreate() {
    return "CREATE".equals(action);
  }

  public boolean isUpdate() {
    return "UPDATE".equals(action);
  }

  public boolean isDelete() {
    return "DELETE".equals(action);
  }
}
