import { BatteryCharge, Refresh } from "@icon-park/react";
import { Card, CardHeader, CardIcon, CardTool, CardBody } from "../window/Card";
import { ToolButton } from "../window/ToolButton";
import { invoke } from "@tauri-apps/api/core";

const PowerPlan = () => {
  return (
    <Card>
      <CardHeader>
        <CardIcon>
          <BatteryCharge /> 电源计划
        </CardIcon>
        <CardTool>
          <ToolButton>
            <Refresh />
            刷新
          </ToolButton>
        </CardTool>
      </CardHeader>
      <CardBody>
        <div className="flex p-0.5 bg-black/5 gap-2 rounded-full">
          <button onClick={() => invoke("set_power_plan", {index: 1})} className="flex-1 px-2 py-1 transition rounded-full bg-black/5">高性能</button>
          <button onClick={() => invoke("set_power_plan", {index: 2})} className="flex-1 px-2 py-1 transition rounded-full">平衡</button>
          <button onClick={() => invoke("set_power_plan", {index: 3})} className="flex-1 px-2 py-1 transition rounded-full">节能</button>
        </div>
      </CardBody>
    </Card>
  );
};

export default PowerPlan;
