import { describe, expect, it } from 'vitest';
import {
  CreateNoteDraftToolInputSchema,
  NotesMcpToolDefinitions,
  SearchNotesToolInputSchema,
} from './note-tool-contracts.js';

describe('note MCP tool contracts', () => {
  it('defines the expected core tool names', () => {
    expect(NotesMcpToolDefinitions.list.name).toBe('notes.notes.list');
    expect(NotesMcpToolDefinitions.get.name).toBe('notes.notes.get');
    expect(NotesMcpToolDefinitions.search.name).toBe('notes.notes.search');
    expect(NotesMcpToolDefinitions.createDraft.name).toBe('notes.notes.create_draft');
  });

  it('validates search input', () => {
    const parsed = SearchNotesToolInputSchema.safeParse({
      workspaceId: 'ws_1',
      query: 'retention policy',
    });

    expect(parsed.success).toBe(true);
  });

  it('supports dry-run create draft input', () => {
    const parsed = CreateNoteDraftToolInputSchema.safeParse({
      workspaceId: 'ws_1',
      title: 'Draft note',
      body: 'Body',
      dryRun: true,
    });

    expect(parsed.success).toBe(true);
    if (parsed.success) {
      expect(parsed.data.dryRun).toBe(true);
    }
  });
});
