package Ġcom . so yle . stories . use case . theme . compare Characters Ċ Ċ import Ġcom . so yle . stories . domain . character . Character Ċ import Ġcom . so yle . stories . domain . theme . Character NotIn Theme Ċ import Ġcom . so yle . stories . domain . theme . Theme Ċ import Ġcom . so yle . stories . domain . theme . character In Theme . Major Character Ċ import Ġcom . so yle . stories . use case . theme . Theme DoesNotExist Ċ import Ġcom . so yle . stories . use case . theme . Theme Repository Ċ import Ġjava . util .* Ċ Ċ class ĠCompare Characters UseCase ( ĊĠĠĠ Ġprivate Ġval Ġtheme Repository : ĠTheme Repository Ċ ) Ġ: ĠCompare Characters Ġ{ ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġinvoke ( theme Id : ĠUUID , Ġfocus Character Id : ĠUUID ?, Ġoutput Port : ĠCompare Characters . Output Port ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġresponse Ġ= Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompare Characters ( theme Id , Ġfocus Character Id ) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( t : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreturn Ġoutput Port . receive Compare Characters Failure ( t ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġoutput Port . receive Character Comparison ( response ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġsuspend Ġfun Ġcompare Characters ( theme Id : ĠUUID , Ġfocus Character Id : ĠUUID ?): ĠCompare Characters . Response Model Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġtheme Ġ= Ġget Theme ById ( theme Id ) ĊĠĠĠĠĠĠĠ Ġreturn ĠCompare Characters . Response Model ( theme Id , Ġtheme . characters . map Ġ{ ĊĊĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġsuspend Ġfun Ġget Theme ById ( theme Id : ĠUUID ): ĠTheme Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġtheme Repository . get Theme ById ( Theme . Id ( theme Id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġthrow ĠTheme DoesNotExist ( theme Id ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠTheme . get Focus Character ( focus Character Id : ĠUUID ): ĠMajor Character Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġget Major Character ById ( Character . Id ( focus Character Id )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġthrow ĠCharacter NotIn Theme ( id . uuid , Ġfocus Character Id ) ĊĠĠĠ Ġ} Ċ }