import { useState } from "react";
import { Button } from "antd";
import { PageContainer } from "@/components";
import { Sidebar } from "./components/Sidebar";
import { Container } from "./components/Container";
import style from "./index.module.scss";
import { ASS_INDEX_TYPE } from "@/types";

const IndexPage = () => {
  const [type, setType] = useState(ASS_INDEX_TYPE.FIXED);
  const [currentId, setCurrentId] = useState<number | null>(null);

  return (
    <PageContainer
      title="指标管理"
      headerSlot={
        <div className={style.pageTools}>
          <Button
            type="primary"
            ghost={type !== ASS_INDEX_TYPE.FIXED}
            size="large"
            onClick={() => setType(ASS_INDEX_TYPE.FIXED)}
          >
            定级评估指标
          </Button>
          <Button
            type="primary"
            ghost={type !== ASS_INDEX_TYPE.OPERATION}
            size="large"
            onClick={() => setType(ASS_INDEX_TYPE.OPERATION)}
          >
            运行评估指标
          </Button>
        </div>
      }
    >
      <div className={style.page}>
        <Sidebar
          type={type}
          currentId={currentId}
          setCurrentId={setCurrentId}
        />

        <Container currentId={currentId} />
      </div>
    </PageContainer>
  );
};

export default IndexPage;
