import { describe, expect, it } from 'vitest'
import { getScreenTemplate, screenTemplateCatalogue } from '../catalogue'

describe('screen template catalogue', () => {
  it('defines all ten screen contracts without duplicate IDs or components', () => {
    expect(screenTemplateCatalogue).toHaveLength(10)
    expect(new Set(screenTemplateCatalogue.map(x => x.id)).size).toBe(10)
    expect(new Set(screenTemplateCatalogue.map(x => x.component)).size).toBe(10)
  })

  it('requires evidence and anti-pattern declarations for every template', () => {
    for (const template of screenTemplateCatalogue) {
      expect(template.mandatoryEvidence.length).toBeGreaterThan(0)
      expect(template.mandatoryStates.length).toBeGreaterThan(0)
      expect(template.antiPatterns.length).toBeGreaterThan(0)
    }
  })

  it('resolves a template by stable ID', () => {
    expect(getScreenTemplate('T05').component).toBe('ApprovalWorkbenchPage')
  })
})
