import { Layer4State } from "../../api/NWFilterApi";
import { SelectInput } from "./SelectInput";

export function NWFConnStateInput(p: {
  editable: boolean;
  value?: Layer4State;
  onChange: (s?: Layer4State) => void;
}): React.ReactElement {
  return (
    <SelectInput
      {...p}
      label="Connection state"
      value={p.value}
      onValueChange={(s) => {
        p.onChange?.(s as any);
      }}
      options={[
        { label: "None", value: undefined },
        { label: "NEW", value: "NEW" },
        { label: "ESTABLISHED", value: "ESTABLISHED" },
        { label: "RELATED", value: "RELATED" },
        { label: "INVALID", value: "INVALID" },
        { label: "NONE", value: "NONE" },
      ]}
    />
  );
}
