import { Achievement, AchievementProps } from '@core/identity/domain/entities/Achievement';

export interface IAchievementRepository {
  save(achievement: Achievement): Promise<void>;
  findById(id: string): Promise<Achievement | null>;
}

export class CreateAchievementUseCase {
  constructor(private readonly achievementRepository: IAchievementRepository) {}

  async execute(props: Omit<AchievementProps, 'createdAt'>): Promise<Achievement> {
    const achievement = Achievement.create(props);
    await this.achievementRepository.save(achievement);
    return achievement;
  }
}
