import { PositionStatus } from '../../../generated/ManagingApi'

type IPositionStatusBadge = {
  status: PositionStatus
}
function statusClasses(status: PositionStatus) {
  let commonClasses = 'badge badge-xs '
  switch (status) {
    case PositionStatus.Canceled:
    case PositionStatus.Rejected:
      commonClasses += 'bg-red-100'
      break
    case PositionStatus.New:
      commonClasses += 'bg-blue-100'
      break
    case PositionStatus.PartiallyFilled:
      commonClasses += 'bg-orange-100'
      break
    case PositionStatus.Filled:
      commonClasses += 'bg-green-100'
      break
    default:
      break
  }
  return commonClasses
}

export default function PositionStatusBadge({ status }: IPositionStatusBadge) {
  return <span className={statusClasses(status)}></span>
}
