How to query for available blueprints

I’m writing a site to help UX researchers like myself. Every UX research study run via the site emulates a slice of an ecommerce flow. To that end, a researcher who is setting up a research study must select a “products collection” AKA a category (eg, for a supermarket experience, it might the Dairy section; or it might be “mens sneakers” for a retailer).

The “products collection” blueprint contains things like the maximum number of items to be shown, the sort order, etc. Any “products collection” could be used by multiple studies.

Inside a “products collection”, a researcher will create the individual products as child pages. Different kinds of products will need different blueprints.

I’m getting stumped on how to tell the “product collection” which blueprint to use when the researcher starts creating individual products.

I think it makes sense to offer a select dropdown, which queries for eligible product blueprints. Once the researcher has selected an eligible product blueprint, a pages list would appear and its Create button would be locked to the eligible product blueprint.
Once a child product has been created, the product collection will not allow the child blueprint to be changed.

Could I please get some advice on the best way to approach this?
I think I understand that Panel can’t query for other blueprints… Does that mean I need to look at a hook or an API route..?

(Git repo is available if necessary. )

Must admit that I don’t quite understand. In a pages section, you can set the allowed templates for subpage creation, so you get that dropdown for free. Why do you need to select a page afterwards?

In those subpage templates, you can then set the changeTemplate option to false.

Maybe I’m missing something

I think the request is for that “allowed templates” value to be derived from the value of a field in the parent page, rather than hardcoded in the parent page’s blueprint.

That would require the Pages section’s templates property to support queries (which it may or not, haven’t tried it).

Yes, with a slight clarification. I’ve been hoping that the values in the field on the parent page would come from a query in the first place. I want to avoid hard-coding in the allowed templates.

That said, Sonia’s reminder about “set the changeTemplate option to false” is a great reminder. I’ll need to use that!

And Sonia, to your point “Must admit that I don’t quite understand”… I totally empathise; I’ve been wrestling with how to efficiently describe my intentions for two days now.

Let me see if I can describe the intent of that select dropdown with the query.

When a researcher sets up a product collection, the product collection is unopinionated about which template its children can use.

Once a user/researcher creates their first child page inside a product collection, then I need every subsequent child page to use the same template. The product collection must become opinionated at some point.

So my intent with that select dropdown is to query for eligible templates, and allow the user/researcher to give their new product collection an opinion before they start creating child pages.

Thanks for clarifying, that makes more sense to me now. I guess the way forward would be a custom pages section that makes basically no change apart from making the template option resolve query language.