struct ShowMovie: AppIntent {
   static let title: LocalizedStringResource = "Show Movie"
   static let description = IntentDescription("Shows movies you love or hate.")

   static let supportedModes: IntentModes = .background

   @Parameter
   var movieType: MovieTypes?

   @MainActor
   func perform() async throws -> some IntentResult & ProvidesDialog {
      if movieType == nil {
         movieType = try await $movieType.requestValue("What type of movie?")
      }
      var movie = "Undefined"
      if movieType == .love {
         movie = "Rambo"
      } else if movieType == .hate {
         let confirmation = try await $movieType.requestConfirmation(
            for: movieType!,
            dialog: IntentDialog("Are you sure you want to see the movie you hate?")
         )
         if confirmation {
            movie = "Pulp Fiction"
         }
      }
      return .result(
         dialog: IntentDialog("The movie is \(movie)")
      )
   }
}