config IDF_TARGET
    string
    default "$IDF_TARGET"

config IDF_TARGET_CHIPA
    bool
    default "y" if IDF_TARGET="chipa"

config IDF_TARGET_CHIPB
    bool
    default "y" if IDF_TARGET="chipb"

config ALWAYS_VISIBLE
    bool "Always visible option"

choice ALWAYS_VISIBLE_CHOICE
    prompt "Always visible choice"
    default ALWAYS_VISIBLE_CHOICE_OP1

    config ALWAYS_VISIBLE_CHOICE_OP1
        bool "op1"

    config ALWAYS_VISIBLE_CHOICE_OP2
        bool "op2"
endchoice

config CONFIG_FOR_CHIPA
    bool "Config for chip A"
    depends on IDF_TARGET_CHIPA
    default n

config CONFIG_FOR_CHIPB
    bool "Config for chip B"
    depends on IDF_TARGET_CHIPB

choice CHOICE_FOR_CHIPA
    prompt "Always visible choice"
    default CHOICE_FOR_CHIPA_OP1
    depends on IDF_TARGET_CHIPA

    config CHOICE_FOR_CHIPA_OP1
        bool "op1"

    config CHOICE_FOR_CHIPA_OP2
        bool "op2"
endchoice

choice CHOICE_FOR_CHIPB
    prompt "Always visible choice"
    default CHOICE_FOR_CHIPB_OP1
    depends on IDF_TARGET_CHIPB

    config CHOICE_FOR_CHIPB_OP1
        bool "op1"

    config CHOICE_FOR_CHIPB_OP2
        bool "op2"
endchoice

source "Kconfig.chipa"
source "Kconfig.chipb"

config DEEP_DEPENDENT_CONFIG
    bool "Config depends on another config with default no value"
    depends on CONFIG_FOR_CHIPA

config DEEP_DEPENDENT_CONFIG_INV
    bool "Config depends on the inverted value of another config"
    depends on !CONFIG_FOR_CHIPA

choice DEEP_DEPENDENT_CHOICE
    prompt "depends on target-specific config"
    default DEEP_DEPENDENT_CHOICE_OP1
    depends on DEEP_DEPENDENT_CONFIG

    config DEEP_DEPENDENT_CHOICE_OP1
        bool "op1"

    config DEEP_DEPENDENT_CHOICE_OP2
        bool "op2"
endchoice

config INVISIBLE1
    bool "depends on cannot be satified at the same time"
    depends on CONFIG_FOR_CHIPA && IDF_TARGET_CHIPB

config VISIBLE1
    bool "makes no sense, just for testing OR dependencies"
    depends on CONFIG_FOR_CHIPA || IDF_TARGET_CHIPB

config CONFIG_FOR_CHIPA_DEPENDS_VAR1
    bool "redundant AND in depends on"
    depends on CONFIG_FOR_CHIPA && IDF_TARGET_CHIPA

config CONFIG_FOR_CHIPA_DEPENDS_VAR2
    bool "test AND + NOT"
    depends on CONFIG_FOR_CHIPA && !IDF_TARGET_CHIPB

config CONFIG_FOR_CHIPA_DEPENDS_VAR3
    bool "test NOT"
    depends on !IDF_TARGET_CHIPB

config CONFIG_DEPENDS_ENV_VAR1
    bool "test other environment variable (should be visible because only IDF_TARGET should make something invisible)"
    depends on IDF_XYZ

config CONFIG_DEPENDS_ENV_VAR2
    bool "test other environment variable (should be visible because only IDF_TARGET should make something invisible)"
    depends on !IDF_XYZ

choice CHIPA_VERSION
    prompt "CHIPA version"
    default CHIPA_VERSION2
    depends on CONFIG_FOR_CHIPA

    config CHIPA_VERSION1
        bool "Version 1"
    config CHIPA_VERSION2
        bool "Version 2"
    config CHIPA_VERSION3
        bool "Version 3"
endchoice

config CHIPA_REV_MIN
    int
    default 1 if CHIPA_VERSION1
    default 2 if CHIPA_VERSION2
    default 3 if CHIPA_VERSION3

config CHIPA_FEATURE_FROM_V1
    depends on CONFIG_FOR_CHIPA && (CHIPA_REV_MIN <= 1)
    bool "Feature available from version 1"

config CHIPA_FEATURE_FROM_V3
    depends on CONFIG_FOR_CHIPA && (CHIPA_REV_MIN <= 3)
    bool "Feature available from version 3"

