Custom Models for multiple Cases

Is it possible to give an item a custom model only if it has several custom_model_data strings?

In my json below, I'm trying to make it so if the item has the custom_model_data: ["tm-item", "tm-template", "tm-pickaxe"] it displays a composite of template_base and pickaxe_overlay, but if it just has "tm-item" and "tm-template" it shows the model for template_base:

  "model": {
    "type": "select",
    "property": "custom_model_data",
    "cases": [
      {
        "when": "tm-item",
        "model": {
          "type": "minecraft:select",
          "property": "minecraft:custom_model_data",
          "cases": [
            {
              "when": "tm-template",
              "model": {
                "type": "minecraft:select",
                "property": "minecraft:custom_model_data",
                "cases": [
                  {
                    "when": "tm-base",
                    "model": {
                      "type": "minecraft:model",
                      "model": "item/template_base"
                    }
                  },
                  {
                    "when": "tm-pickaxe",
                    "model": {
                      "type": "minecraft:composite",
                      "models": [
                        {
                          "type": "minecraft:model",
                          "model": "item/template_base"
                        },
                        {
                          "type": "minecraft:model",
                          "model": "item/pickaxe_overlay"
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    ],
    "fallback": {
      "type": "minecraft:model",
      "model": "minecraft:block/command_block"
    }
  }
}```

Maybe there's a better way of doing this? It's been a few years since I've touched resource packs
Continue to help post