/** Снимок адреса из addressSnapshotJson при оформлении заказа */
export type OrderAddressSnapshot = {
  deliveryType?: 'delivery' | 'pickup'
  label?: string | null
  recipientName?: string
  recipientPhone?: string
  addressLine?: string
  comment?: string | null
}

export function parseOrderAddressSnapshot(json: string | null | undefined): OrderAddressSnapshot | null {
  if (!json) return null
  try {
    return JSON.parse(json) as OrderAddressSnapshot
  } catch {
    return null
  }
}
