Develop an Android application using Jetpack Compose that displays a grid of items, handles network state transitions (loading, success, failure), and navigates to a detailed view when an item is tapped.
For grading, implement the equivalent state transformation as a pure function. The function receives items, a network state, a column count, and an optional tapped item ID, then returns the screen model to render.
items is a list of objects with id and title; network_state is "loading", "success", or "failure". Return a dictionary containing the rendered state, row-based grid data when successful, and selected item details when applicable.
id and a string titlenetwork_state is one of loading, success, or failuretapped_id is null or an item IDdef build_screen_model(items, network_state, columns, tapped_id):