/**
 * 被动订单
 */
import React, { FC } from "react";
import { Checkbox, Tooltip } from "@atomintl/aui-next";

interface Props {
  checked?: boolean;
  onChange?: (checked: boolean) => void;
}

export const PostOnly: FC<Props> = props => {
  const { checked } = props;

  return (
    <Checkbox
      checked={checked}
      onChange={event => {
        props.onChange?.(event?.target?.checked);
      }}
    >
      <Tooltip
        title={"被动订单只能以挂单形式成交。如果该订单会立刻以吃单形式与已有订单撮合成交，那么该订单将会被自动取消。"}
        placement="bottom-start"
        width="300px"
        horizontalOffset={-20}
      >
        <span className="nts-post-only-checkbox text-derive-11 text-[12px] hover:text-gray-16">被动订单</span>
      </Tooltip>
    </Checkbox>
  );
};

PostOnly.defaultProps = {
  checked: false,
  onChange: checked => {}
};
