import { test } from '@japa/runner'
import {
  createSummarySemantic,
  isSummarySemantic,
  DEFAULT_SUMMARY_CONFIG,
  type SummaryConfig,
} from '../../../../src/modeling/definitions/Summary.js'
import { SemanticType, type AppliedDataSemantic } from '../../../../src/modeling/Semantics.js'

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

  test('should create semantic with custom config', ({ assert }) => {
    const config: SummaryConfig = {
      metadata: { customField: 'value' },
    }
    const semantic = createSummarySemantic(config)
    assert.equal(semantic.id, SemanticType.Summary)
    assert.deepEqual(semantic.config, { ...DEFAULT_SUMMARY_CONFIG, ...config })
  })

  test('should identify summary semantic', ({ assert }) => {
    const semantic = createSummarySemantic()
    assert.isTrue(isSummarySemantic(semantic))
  })

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