## ----setup, include=FALSE-----------------------------------------------------
# The following examples require the authenticated live SDMX service.
# Disable network calls during package builds and R CMD check.
knitr::opts_chunk$set(eval = FALSE, collapse = TRUE, comment = "#>")

## ----load---------------------------------------------------------------------
# library(tuiksdmx)
# id <- "DF_TUFE_SDMX_TT01"
# profile <- tuik_flow_profile(id)

## ----raw----------------------------------------------------------------------
# raw <- tuik_get_data(
#   profile,
#   start_period = "2026-01",
#   end_period = "2026-01"
# )
# 
# # The original coded dimension values are preserved
# raw[, intersect(c("FREQ", "DEGISIM", "COICOP_2018", "TIME_PERIOD", "OBS_VALUE"),
#                 names(raw)), drop = FALSE]

## ----retrieval-labels---------------------------------------------------------
# cpi_tr <- tuik_get_data(
#   profile,
#   start_period = "2026-01",
#   end_period = "2026-01",
#   labels = "tr",
#   label_dimensions = c("FREQ", "DEGISIM")
# )
# 
# # The code column and its Turkish label appear side by side
# head(cpi_tr[, c("DEGISIM", "DEGISIM_label_tr"), drop = FALSE])
# 
# cpi_both <- tuik_get_data(
#   profile,
#   start_period = "2026-01",
#   end_period = "2026-01",
#   labels = "both",
#   label_dimensions = c("DEGISIM", "COICOP_2018")
# )
# 
# head(cpi_both[, c("DEGISIM", "DEGISIM_label_tr", "DEGISIM_label_en"),
#               drop = FALSE])

## ----decode-existing----------------------------------------------------------
# decoded <- tuik_decode_data(
#   raw,
#   profile,
#   dimensions = c("FREQ", "DEGISIM"),
#   language = "both"
# )
# 
# head(decoded[, c("FREQ", "FREQ_label_tr", "FREQ_label_en"),
#              drop = FALSE])

## ----discovery----------------------------------------------------------------
# tuik_filter_dimensions(profile)
# tuik_dimension_codes(profile, dimension = "DEGISIM")
# 
# # Inspect codes/descriptions in the interactive-style helper
# tuik_explore(profile, dimension = "COICOP_2018", search = "gıda")

## ----availability-------------------------------------------------------------
# # Defined domain: Codelist codes and descriptions
# possible <- tuik_dimension_codes(profile, dimension = "COICOP_2018")
# 
# # Observed domain: codes in returned observation rows for a bounded query
# observed <- tuik_available_codes(
#   profile,
#   dimension = "COICOP_2018",
#   start_period = "2026-01",
#   end_period = "2026-01",
#   allow_all = TRUE
# )

