import type { NoteRepository } from '../repository/NoteRepository.js';

export class IntentService {
  constructor(private repo: NoteRepository) {}

  setIntent(noteId: string, text: string): void {
    if (text.trim().length === 0) throw new Error('empty intent text');
    if (!this.repo.findById(noteId)) throw new Error('note not found');
    this.repo.setIntent(noteId, text);
  }

  dismissIntent(noteId: string): void {
    if (!this.repo.findById(noteId)) throw new Error('note not found');
    this.repo.dismissIntent(noteId);
  }
}
