import { test } from '@japa/runner'
import {
  createDescriptionSemantic,
  isDescriptionSemantic,
  DEFAULT_DESCRIPTION_CONFIG,
  type DescriptionConfig,
} from '../../../../src/modeling/definitions/Description.js'
import { SemanticType, type AppliedDataSemantic } from '../../../../src/modeling/Semantics.js'

test.group('Description Semantic Configuration', () => {
  test('should create semantic with default config', ({ assert }) => {
    const semantic = createDescriptionSemantic()
    assert.equal(semantic.id, SemanticType.Description)
    assert.deepEqual(semantic.config, DEFAULT_DESCRIPTION_CONFIG)
  })

  test('should create semantic with custom config', ({ assert }) => {
    const config: DescriptionConfig = {
      allowMarkdown: true,
    }
    const semantic = createDescriptionSemantic(config)
    assert.equal(semantic.id, SemanticType.Description)
    assert.deepEqual(semantic.config, { ...DEFAULT_DESCRIPTION_CONFIG, ...config })
  })

  test('should identify description semantic', ({ assert }) => {
    const semantic = createDescriptionSemantic()
    assert.isTrue(isDescriptionSemantic(semantic))
  })

  test('should not identify non-description semantic', ({ assert }) => {
    // Simulate a different semantic
    const fakeSemantic: AppliedDataSemantic = { id: SemanticType.Email, config: {} }
    assert.isFalse(isDescriptionSemantic(fakeSemantic))
  })
})
