import type { StatusColor } from '../types'

export function useStatus() {
  const statusMessage = useState<string>('status-message', () => '')
  const statusDescription = useState<string>('status-description', () => '')
  const statusColor = useState<StatusColor>('status-color', () => 'neutral')
  const statusIcon = useState<string>('status-icon', () => '')

  function showStatus(
    message: string,
    description: string = '',
    color: StatusColor = 'neutral',
    icon: string = ''
  ) {
    statusMessage.value = message
    statusDescription.value = description
    statusColor.value = color
    statusIcon.value = icon
  }

  function clearStatus() {
    statusMessage.value = ''
    statusDescription.value = ''
    statusColor.value = 'neutral'
    statusIcon.value = ''
  }

  return {
    statusMessage,
    statusDescription,
    statusColor,
    statusIcon,
    showStatus,
    clearStatus
  }
}
