struct ShowMovie: AppIntent {
   static let title: LocalizedStringResource = "Find Movie"
   static let description = IntentDescription("Finds a movie.")

   static let supportedModes: IntentModes = .background

   @Parameter(title: "Title", requestValueDialog: "What's the movie you want to see?")
   var search: String

   @MainActor
   func perform() async throws -> some IntentResult & ProvidesDialog {
      let appData = ApplicationData.shared

      let movie = appData.listMovies.first(where: {
         $0.title.localizedCaseInsensitiveContains(search)
      })
      guard let movie = movie else {
         throw ErrorIntent.movieNotFound
      }
      return .result(
         dialog: IntentDialog("The movie is \(movie.title)")
      )
   }
}