/**
 * Copyright (c) 2023-present Plane Software, Inc. and contributors
 * SPDX-License-Identifier: AGPL-3.0-only
 * See the LICENSE file for details.
 */

import { useTranslation } from "@plane/i18n";
import { StateGroupIcon } from "@plane/propel/icons";
import type { TExternalContourRequest } from "@plane/types";

type Props = {
  request: TExternalContourRequest;
  iconSize?: string;
};

export function ExternalContourStatePill(props: Props) {
  const { request, iconSize = "size-3.5" } = props;
  const { t } = useTranslation();
  const state = request.issue.state_detail;

  return (
    <div className="inline-flex items-center gap-1 rounded-sm border border-subtle bg-layer-2 px-1.5 py-0.5 text-11 font-medium text-secondary">
      <StateGroupIcon
        stateGroup={state?.group ?? "backlog"}
        color={state?.color}
        className={`${iconSize} shrink-0`}
      />
      <span className="whitespace-nowrap">{state?.name || t("state")}</span>
    </div>
  );
}
