import type { PageableList, PageableParams } from "@/shared/model"; import { z } from "zod"; export const POSTING_TYPE = { POPUP: "POPUP", BANNER: "BANNER", IMAGE: "IMAGE", } as const; export type PostingType = (typeof POSTING_TYPE)[keyof typeof POSTING_TYPE]; export interface PostingParams extends PageableParams { pstgTrgtNo: number; } export const postSchema = z.object({ siteId: z.string(), siteNm: z.string(), pstgTypeCd: z.string(), pstgTypeNm: z.string(), pstgTrgtNo: z.number(), pstgBgngDt: z.string().optional(), pstgEndDt: z.string().optional(), pstgPrdSeCd: z.string(), pstgPrdSeNm: z.string(), delYn: z.string(), }); export const postPayloadSchema = postSchema .extend({ mode: z.string(), }) .omit({ siteNm: true, pstgTypeNm: true, pstgPrdSeNm: true, }); export const postingFormSchema = z.object({ pstg: z.array(postPayloadSchema), }); export type Post = z.infer; export type PostPayloadData = z.infer; export type PostingFormData = z.infer; export interface PostService { getPostingHistory: (params: PostingParams) => Promise>; savePosting: (data: PostPayloadData[]) => Promise; }