import { createSearchParamsCache, parseAsArrayOf, parseAsInteger, parseAsString, parseAsStringEnum,parseAsBoolean } from "nuqs/server" import * as z from "zod" import { getFiltersStateParser, getSortingStateParser } from "@/lib/parsers" import { VendorQuotationView } from "@/db/schema"; export const searchParamsVendorRfqCache = createSearchParamsCache({ flags: parseAsArrayOf(z.enum(["advancedTable", "floatingBar"])).withDefault([]), page: parseAsInteger.withDefault(1), perPage: parseAsInteger.withDefault(10), sort: getSortingStateParser().withDefault([ { id: "updatedAt", desc: true }, ]), // 고급 필터 filters: getFiltersStateParser().withDefault([]), joinOperator: parseAsStringEnum(["and", "or"]).withDefault("and"), search: parseAsString.withDefault(""), from: parseAsString.withDefault(""), to: parseAsString.withDefault(""), }); export type GetQuotationsLastSchema = Awaited>; // 참여 여부 업데이트 스키마 export const updateParticipationSchema = z.object({ rfqId: z.number(), rfqLastDetailsId: z.number(), participationStatus: z.enum(["참여", "불참"]), nonParticipationReason: z.string().optional(), }) export type UpdateParticipationSchema = z.infer;