// pages/rh/calculo_impostos.tsx
import { useState } from "react";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";

export default function CalculoImpostos() {
  const [competencia, setCompetencia] = useState("");
  const [dados, setDados] = useState<any[]>([]);

  const handleCalcular = () => {
    setDados([
      { tipo: "INSS", valor: 13450.87 },
      { tipo: "FGTS", valor: 9200.45 },
      { tipo: "IRRF", valor: 3250.00 }
    ]);
  };

  return (
    <div className="p-6">
      <h1 className="text-xl font-bold mb-4">Cálculo de Impostos</h1>
      <Card className="mb-4">
        <CardContent className="flex gap-4 pt-4">
          <Input
            type="month"
            value={competencia}
            onChange={(e) => setCompetencia(e.target.value)}
          />
          <Button onClick={handleCalcular}>Calcular</Button>
        </CardContent>
      </Card>

      <Card>
        <CardContent className="pt-4">
          <Table>
            <TableHeader>
              <TableRow>
                <TableHead>Imposto</TableHead>
                <TableHead>Valor (R$)</TableHead>
              </TableRow>
            </TableHeader>
            <TableBody>
              {dados.map((item, i) => (
                <TableRow key={i}>
                  <TableCell>{item.tipo}</TableCell>
                  <TableCell>{item.valor.toFixed(2)}</TableCell>
                </TableRow>
              ))}
            </TableBody>
          </Table>
        </CardContent>
      </Card>
    </div>
  );
}
