import { describe, expect, it } from 'vitest'
import { statusToneFromSeverity, statusToneFromState } from '../status-tone'

describe('statusToneFromSeverity', () => {
  it('returns rose for critical', () => {
    expect(statusToneFromSeverity('critical')).toBe('rose')
  })

  it('returns orange for high', () => {
    expect(statusToneFromSeverity('high')).toBe('orange')
  })

  it('returns amber for medium', () => {
    expect(statusToneFromSeverity('medium')).toBe('amber')
  })

  it('returns cyan for low', () => {
    expect(statusToneFromSeverity('low')).toBe('cyan')
  })

  it('returns glass for info', () => {
    expect(statusToneFromSeverity('info')).toBe('glass')
  })

  it('is case-insensitive (Critical)', () => {
    expect(statusToneFromSeverity('Critical')).toBe('rose')
  })

  it('is case-insensitive (CRITICAL)', () => {
    expect(statusToneFromSeverity('CRITICAL')).toBe('rose')
  })

  it('is case-insensitive (mixed case HIGH)', () => {
    expect(statusToneFromSeverity('HiGh')).toBe('orange')
  })

  it('falls back to glass for unknown values', () => {
    expect(statusToneFromSeverity('unknown')).toBe('glass')
    expect(statusToneFromSeverity('severe')).toBe('glass')
  })

  it('falls back to glass for empty string', () => {
    expect(statusToneFromSeverity('')).toBe('glass')
  })
})

describe('statusToneFromState', () => {
  it('returns emerald for active', () => {
    expect(statusToneFromState('active')).toBe('emerald')
  })

  it('returns emerald for connected', () => {
    expect(statusToneFromState('connected')).toBe('emerald')
  })

  it('returns emerald for passing', () => {
    expect(statusToneFromState('passing')).toBe('emerald')
  })

  it('returns emerald for enabled', () => {
    expect(statusToneFromState('enabled')).toBe('emerald')
  })

  it('returns emerald for healthy', () => {
    expect(statusToneFromState('healthy')).toBe('emerald')
  })

  it('returns cyan for running', () => {
    expect(statusToneFromState('running')).toBe('cyan')
  })

  it('returns cyan for testing', () => {
    expect(statusToneFromState('testing')).toBe('cyan')
  })

  it('returns cyan for completed', () => {
    expect(statusToneFromState('completed')).toBe('cyan')
  })

  it('returns rose for error', () => {
    expect(statusToneFromState('error')).toBe('rose')
  })

  it('returns rose for failed', () => {
    expect(statusToneFromState('failed')).toBe('rose')
  })

  it('returns rose for disconnected', () => {
    expect(statusToneFromState('disconnected')).toBe('rose')
  })

  it('returns rose for attention', () => {
    expect(statusToneFromState('attention')).toBe('rose')
  })

  it('returns amber for pending', () => {
    expect(statusToneFromState('pending')).toBe('amber')
  })

  it('returns amber for needs_setup', () => {
    expect(statusToneFromState('needs_setup')).toBe('amber')
  })

  it('returns amber for needs_review', () => {
    expect(statusToneFromState('needs_review')).toBe('amber')
  })

  it('returns amber for stale', () => {
    expect(statusToneFromState('stale')).toBe('amber')
  })

  it('returns amber for available', () => {
    expect(statusToneFromState('available')).toBe('amber')
  })

  it('returns amber for queued', () => {
    expect(statusToneFromState('queued')).toBe('amber')
  })

  it('returns amber for generating', () => {
    expect(statusToneFromState('generating')).toBe('amber')
  })

  it('returns amber for purging', () => {
    expect(statusToneFromState('purging')).toBe('amber')
  })

  it('returns violet for quarantined', () => {
    expect(statusToneFromState('quarantined')).toBe('violet')
  })

  it('returns glass for disabled', () => {
    expect(statusToneFromState('disabled')).toBe('glass')
  })

  it('returns glass for inactive', () => {
    expect(statusToneFromState('inactive')).toBe('glass')
  })

  it('returns glass for decommissioned', () => {
    expect(statusToneFromState('decommissioned')).toBe('glass')
  })

  it('is case-insensitive (Active)', () => {
    expect(statusToneFromState('Active')).toBe('emerald')
  })

  it('is case-insensitive (ERROR)', () => {
    expect(statusToneFromState('ERROR')).toBe('rose')
  })

  it('is case-insensitive (Pending)', () => {
    expect(statusToneFromState('Pending')).toBe('amber')
  })

  it('falls back to glass for unknown values', () => {
    expect(statusToneFromState('unknown')).toBe('glass')
    expect(statusToneFromState('something')).toBe('glass')
  })

  it('falls back to glass for empty string', () => {
    expect(statusToneFromState('')).toBe('glass')
  })
})
