import { db } from "@/src/db";
import LocationSelector from "../../components/LocationSelector";
import LocationContextProvider from "@/components/locationContext";
import TotalSetter from "./TotalSetter";
import { eq } from "drizzle-orm";
import { user } from "@/src/schema";

export default async function Page() {
  const provinces = await db.query.province
    .findMany({ with: { zones: true } })
    .execute();
  const jobList = await db.query.group.findMany().execute();
  let r = await db.query.user
    .findMany({ columns: { id: true }, where: eq(user.verified, true) })
    .execute()
    .then((v) => v.length);
  console.log(r);
  return (
    <LocationContextProvider>
      <LocationSelector provinces={provinces} />
      <TotalSetter />
    </LocationContextProvider>
  );
}
