## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(eval = FALSE, collapse = TRUE, comment = "#>")

## ----setup-profile------------------------------------------------------------
# library(tuiksdmx)
# profile <- tuik_flow_profile("DF_TUFE_SDMX_TT01")

## ----unfiltered---------------------------------------------------------------
# cpi_month <- tuik_get_data(
#   "DF_TUFE_SDMX_TT01",
#   start_period = "2026-01",
#   end_period = "2026-01"
# )
# nrow(cpi_month)

## ----partial------------------------------------------------------------------
# chosen <- list(FREQ = "M", DEGISIM = "1")
# 
# tuik_explore(profile, filters = chosen)
# 
# tuik_missing_filters(profile, chosen)
# 
# cpi_subset <- tuik_get_data(
#   profile,
#   filters = chosen,
#   start_period = "2026-01",
#   end_period = "2026-01",
#   allow_all = TRUE
# )

## ----complete-----------------------------------------------------------------
# all_dimensions <- tuik_filter_dimensions(profile)
# all_dimensions
# 
# filters <- list(
#   REF_AREA = "TR",
#   FREQ = "M",
#   SINIFLAMA_DUZEYI = "2",
#   DEGISIM = "1",
#   OZEL_KAPSAM_TUFE = "_Z",
#   BASE_PER = "2025",
#   YAYIM_DONEMI = "2026_01",
#   COICOP_1999 = "_Z",
#   COICOP_2018 = "01",
#   INDICATOR = "F_TFE"
# )
# 
# # Check that every key dimension is present
# tuik_missing_filters(profile, filters)
# 
# # Check defined code membership against referenced Codelists
# tuik_validate_filters(profile, filters)
# 
# # Inspect the constructed key if needed (normally not required)
# tuik_build_key(profile, filters)
# 
# cpi_food <- tuik_get_data(
#   profile,
#   filters = filters,
#   start_period = "2026-01",
#   end_period = "2026-01"
# )

## ----unbounded----------------------------------------------------------------
# # Potentially VERY large: intentionally avoid in routine analysis.
# # Deliberately commented out: may download the entire Dataflow.
# # whole_flow <- tuik_get_data(
# #   profile,
# #   allow_unbounded = TRUE
# # )

## ----labels-------------------------------------------------------------------
# cpi_labeled <- tuik_get_data(
#   profile,
#   start_period = "2026-01",
#   end_period = "2026-01",
#   labels = "tr",
#   label_dimensions = c("COICOP_2018", "DEGISIM")
# )

