import { describe, it, expect } from 'vitest'
import {
  GENDER_OPTIONS,
  BLOOD_TYPE_OPTIONS,
  STATUS_OPTIONS,
} from './health'

describe('GENDER_OPTIONS', () => {
  it('should be an array with 3 items', () => {
    expect(GENDER_OPTIONS).toBeInstanceOf(Array)
    expect(GENDER_OPTIONS).toHaveLength(3)
  })

  it('each item should have value and label string properties', () => {
    for (const opt of GENDER_OPTIONS) {
      expect(opt).toHaveProperty('value')
      expect(opt).toHaveProperty('label')
      expect(typeof opt.value).toBe('string')
      expect(typeof opt.label).toBe('string')
    }
  })

  it('should contain expected gender values', () => {
    const values = GENDER_OPTIONS.map((o) => o.value)
    expect(values).toEqual(['male', 'female', 'other'])
  })

  it('should contain expected Chinese labels', () => {
    const labels = GENDER_OPTIONS.map((o) => o.label)
    expect(labels).toEqual(['男', '女', '其他'])
  })
})

describe('BLOOD_TYPE_OPTIONS', () => {
  it('should be an array with 4 items', () => {
    expect(BLOOD_TYPE_OPTIONS).toBeInstanceOf(Array)
    expect(BLOOD_TYPE_OPTIONS).toHaveLength(4)
  })

  it('each item should have value and label string properties', () => {
    for (const opt of BLOOD_TYPE_OPTIONS) {
      expect(opt).toHaveProperty('value')
      expect(opt).toHaveProperty('label')
      expect(typeof opt.value).toBe('string')
      expect(typeof opt.label).toBe('string')
    }
  })

  it('should contain expected blood type values', () => {
    const values = BLOOD_TYPE_OPTIONS.map((o) => o.value)
    expect(values).toEqual(['A', 'B', 'AB', 'O'])
  })

  it('should contain expected Chinese labels', () => {
    const labels = BLOOD_TYPE_OPTIONS.map((o) => o.label)
    expect(labels).toEqual(['A 型', 'B 型', 'AB 型', 'O 型'])
  })
})

describe('STATUS_OPTIONS', () => {
  it('should be an array with 4 items', () => {
    expect(STATUS_OPTIONS).toBeInstanceOf(Array)
    expect(STATUS_OPTIONS).toHaveLength(4)
  })

  it('each item should have value and label string properties', () => {
    for (const opt of STATUS_OPTIONS) {
      expect(opt).toHaveProperty('value')
      expect(opt).toHaveProperty('label')
      expect(typeof opt.value).toBe('string')
      expect(typeof opt.label).toBe('string')
    }
  })

  it('should include an empty-string value for "all statuses" filter', () => {
    const allOption = STATUS_OPTIONS.find((o) => o.value === '')
    expect(allOption).toBeDefined()
    expect(allOption!.label).toBe('全部状态')
  })

  it('should contain expected status values', () => {
    const values = STATUS_OPTIONS.map((o) => o.value)
    expect(values).toEqual(['', 'active', 'inactive', 'deceased'])
  })
})
