/* * 관람객(B2C) API 배선 — 공개 혼잡/주차/공지 + 인증 주차권. * 계약: _workspace/parking_congestion_contract.md · src/backend/_workspace/cms_backlog_contract.md. * 봉투 언랩·인증 헤더는 lib/api.ts가 처리. 공개 조회는 anonymous(토큰 미첨부). * 주차권 구매/조회는 인증(JWT). PII(차량번호)는 서버가 마스킹해 반환 — 원문 미저장. */ import { api } from './api'; import type { CongestionOverviewDto, LiveNoticeDto, MyPassesDto, ParkingLotStatusDto, ParkingPassDto, PurchasePassRequest, } from './types'; /** 주차 현황 — 공개(비로그인). eventId는 선택. */ export function getParkingLots(eventId?: string): Promise { const q = eventId ? `?eventId=${encodeURIComponent(eventId)}` : ''; return api.get(`/api/public/parking/lots${q}`, { anonymous: true }); } /** 혼잡 요약 — 공개. eventId 필수. */ export function getCongestion(eventId: string): Promise { return api.get( `/api/public/congestion?eventId=${encodeURIComponent(eventId)}`, { anonymous: true }, ); } /** 라이브 공지 — 공개. 게시(pinned 우선→최신) 건만. */ export function getLiveNotices(eventId: string, limit = 100): Promise { return api.get( `/api/public/events/${encodeURIComponent(eventId)}/live-notices?limit=${limit}`, { anonymous: true }, ); } /** 사전 주차권 구매(mock 결제) — 인증. 구매자 = JWT 주체. */ export function purchaseParkingPass(req: PurchasePassRequest): Promise { return api.post('/api/parking/passes', req); } /** 내 주차권 조회 — 인증(본인 소유분만). */ export function getMyParkingPasses(): Promise { return api.get('/api/parking/passes/me'); }