How to implement randomly generated data structure

As a desing always break down what you thinking if it comes as complex (or thinking that you should do that dynamic structure) and your design nothing in need with dynamic.

First thing comes to my mind is :

[Document Class] will have

  • Pages as List (Page can be [String]), or if you have some structure you can change [String] to [Page])
  • Book Cover
  • Type

What your Computer will have ? SearchFromDocument function, it will have input as your [Document Class].

That search function will go over PageList at your document and search Pages through (maybe Regex). If it founds it will return [Page] class that you can show to user or edit it. Depends on how you design.