We have a multi level Tag Hierarchy i.e Brand>Location>Shop-ID>Terminal-ID .
A terminal or shopid can belong to multiple locations and brands. i,e UK>London>Shop-1>terminal-1234, UK>Paris>Shop-1>terminal-1234 , UK>XYZ>Shop-2>terminal-1234.
All the pages will be tagged to a location i.e London,Paris etc and not to terminal-ID or Shop-Id. We have third parties querying AEM with terminal ID or Shop ID and we need to return all pages that is being tagged to any parent tag which has terminal-Id below it in tag hierarchy.
What is the best possible approach to tackle this use case?