import { describe, expect, it } from 'vitest'
import {
  CreateNoteRequestSchema,
  NoteTypeSchema,
  UpdateMilestoneRequestSchema
} from './api-schemas'

describe('NoteTypeSchema', () => {
  it('accepts agent_learning', () => {
    expect(NoteTypeSchema.safeParse('agent_learning').success).toBe(true)
  })
})

describe('CreateNoteRequestSchema', () => {
  it('accepts agent_learning notes', () => {
    const result = CreateNoteRequestSchema.safeParse({
      project_id: '123e4567-e89b-12d3-a456-426614174000',
      type: 'agent_learning',
      content: 'Capture a reusable implementation lesson for this project.'
    })

    expect(result.success).toBe(true)
  })
})

describe('UpdateMilestoneRequestSchema', () => {
  it('accepts description-only updates', () => {
    const result = UpdateMilestoneRequestSchema.safeParse({
      description: ''
    })

    expect(result.success).toBe(true)
  })

  it('rejects empty payloads', () => {
    const result = UpdateMilestoneRequestSchema.safeParse({})
    expect(result.success).toBe(false)
  })
})
