version: 1
context:
    foo: bar
    policy_property: name
    policy_property_value: foo-bar-baz-qux
    sequence:
    - foo
    - bar
    mapping:
      key1: value
      key2: 2
    context1: context-nested-value
    context2: !Context context1
entries:
    - model: !Format ["%%s", authentik_sources_oauth.oauthsource]
      state: !Format ["%%s", present]
      identifiers:
          slug: test
      attrs:
          name: test
          provider_type: github
          consumer_key: !Env foo
          consumer_secret: !Env [bar, baz]
          authentication_flow:
              !Find [
                  authentik_flows.Flow,
                  [slug, default-source-authentication],
              ]
          enrollment_flow:
              !Find [!Format  ["%%s", authentik_flows.Flow], [slug, default-source-enrollment]]
    - attrs:
          expression: return True
      identifiers:
          name: !Format [foo-%%s-%%s-%%s, !Context foo, !Context bar, qux]
      id: policy
      model: authentik_policies_expression.expressionpolicy
    - attrs:
          attributes:
              env_null: !Env [bar-baz, null]
              file_content: !File '%(file_name)s'
              file_default: !File ['%(file_default_name)s', 'default']
              file_non_existent: !File '/does-not-exist'
              json_parse: !ParseJSON '{"foo": "bar"}'
              policy_pk1:
                  !Format [
                      "%%s-%%s",
                      !Find [
                          authentik_policies_expression.expressionpolicy,
                          [
                              !Context policy_property,
                              !Context policy_property_value,
                          ],
                          [expression, return True],
                      ],
                      suffix,
                  ]
              policy_pk2: !Format ["%%s-%%s", !KeyOf policy, suffix]
              boolAnd:
                  !Condition [AND, !Context foo, !Format ["%%s", "a_string"], 1]
              boolNand:
                  !Condition [NAND, !Context foo, !Format ["%%s", "a_string"], 1]
              boolOr:
                  !Condition [
                      OR,
                      !Context foo,
                      !Format ["%%s", "a_string"],
                      null,
                  ]
              boolNor:
                  !Condition [
                      NOR,
                      !Context foo,
                      !Format ["%%s", "a_string"],
                      null,
                  ]
              boolXor:
                  !Condition [XOR, !Context foo, !Format ["%%s", "a_string"], 1]
              boolXnor:
                  !Condition [XNOR, !Context foo, !Format ["%%s", "a_string"], 1]
              boolComplex:
                  !Condition [
                      XNOR,
                      !Condition [AND, !Context non_existing],
                      !Condition [NOR, a string],
                      !Condition [XOR, null],
                  ]
              if_true_complex:
                  !If [
                      true,
                      {
                          dictionary:
                              {
                                  with: { keys: "and_values" },
                                  and_nested_custom_tags:
                                      !Format ["foo-%%s", !Context foo],
                              },
                      },
                      null,
                  ]
              if_false_complex:
                  !If [
                      !Condition [AND, false],
                      null,
                      [list, with, items, !Format ["foo-%%s", !Context foo]],
                  ]
              if_true_simple: !If [!Context foo, true, text]
              if_short: !If [!Context foo]
              if_false_simple: !If [null, false, 2]
              enumerate_mapping_to_mapping: !Enumerate [
                  !Context mapping,
                  MAP,
                  [!Format ["prefix-%%s", !Index 0], !Format ["other-prefix-%%s", !Value 0]]
              ]
              enumerate_mapping_to_sequence: !Enumerate [
                  !Context mapping,
                  SEQ,
                  !Format ["prefixed-pair-%%s-%%s", !Index 0, !Value 0]
              ]
              enumerate_sequence_to_sequence: !Enumerate [
                  !Context sequence,
                  SEQ,
                  !Format ["prefixed-items-%%s-%%s", !Index 0, !Value 0]
              ]
              enumerate_sequence_to_mapping: !Enumerate [
                  !Context sequence,
                  MAP,
                  [!Format ["index: %%d", !Index 0], !Value 0]
              ]
              nested_complex_enumeration: !Enumerate [
                  !Context sequence,
                  MAP,
                  [
                      !Index 0,
                      !Enumerate [
                          !Context mapping,
                          MAP,
                          [
                              !Format ["%%s", !Index 0],
                              [
                                  !Enumerate [!Value 2, SEQ, !Format ["prefixed-%%s", !Value 0]],
                                  {
                                    outer_value: !Value 1,
                                    outer_index: !Index 1,
                                    middle_value: !Value 0,
                                    middle_index: !Index 0
                                  }
                              ]
                          ]
                      ]
                  ]
              ]
              nested_context: !Context context2
              at_index_sequence: !AtIndex [!Context sequence, 0]
              at_index_sequence_default: !AtIndex [!Context sequence, 100, "non existent"]
              at_index_mapping: !AtIndex [!Context mapping, "key2"]
              at_index_mapping_default: !AtIndex [!Context mapping, "invalid", "non existent"]
              find_object: !AtIndex [!FindObject [authentik_providers_oauth2.scopemapping, [scope_name, openid]], managed]
      identifiers:
          name: test
      conditions:
          - !Condition [AND, true, true, text]
          - true
          - text
      model: authentik_core.group
