import React from "react";

interface Props {
  serverStatus: string;
}

const serverStatus = ({ serverStatus }: Props) => {
  let color = "bg-danger";
  switch (serverStatus) {
    case "running":
      serverStatus = "Running";
      color = "bg-success";
      break;
    case "offline":
      serverStatus = "Offline";
      color = "bg-error";
      break;
    case "starting":
      serverStatus = "Starting";
      color = "bg-info";
      break;
    case "stopping":
      serverStatus = "Stopping";
      color = "bg-error";
      break;
    default:
      serverStatus = "N/A";
  }

  let bgColor =
    "p-3 rounded-md w-32 font-weight-600 font-face text-center " + color;

  return (
    <>
      <div className={bgColor}>{serverStatus}</div>
    </>
  );
};

export default serverStatus;
