package Ġuk . gov . just ice . digital . h mp ps . h mp ps restricted pat ients api . services Ċ Ċ import Ġcom . amazonaws . services . sns . Amazon S NS Ċ import Ġcom . google . gson . Gson Ċ import Ġorg . springframework . cloud . aws . messaging . core . Notification Messaging Template Ċ import Ġorg . springframework . cloud . aws . messaging . core . Topic Message Channel Ċ import Ġjava . time . LocalDateTime Ċ import Ġjava . time . Zone Id Ċ import Ġjava . time . format . DateTime Formatter Ċ Ċ data Ġclass ĠDomain Event ( ĊĠ Ġval ĠeventType : ĠString , ĊĠ Ġval Ġadditional Information : ĠRe stricted Patient Removed Additional Information , ĊĠ Ġval Ġversion : ĠInt , ĊĠ Ġval Ġoccurred At : ĠString , ĊĠ Ġval Ġpublished At : ĠString , ĊĠ Ġval Ġdescription : ĠString Ċ ) Ċ Ċ data Ġclass ĠRe stricted Patient Removed Additional Information ( val Ġpr isoner Number : ĠString ) Ċ Ċ interface ĠDomain Event Publisher Ġ{ ĊĠ Ġfun Ġpublish Restricted Patient Removed ( pr isoner Number : ĠString ) Ċ } Ċ Ċ class ĠStub Domain Event Publisher Ġ: ĠDomain Event Publisher Ġ{ ĊĠ Ġoverride Ġfun Ġpublish Restricted Patient Removed ( pr isoner Number : ĠString ) Ġ{} Ċ } Ċ Ċ class ĠDomain Event Publisher Impl ( client : ĠAmazon S NS , Ġtopic Arn : ĠString , Ġprivate Ġval Ġgson : ĠGson ) Ġ: ĊĠ ĠDomain Event Publisher Ġ{ ĊĊĠ Ġprivate Ġval Ġtopic Template Ġ= ĠNotification Messaging Template ( client ) ĊĠ Ġprivate Ġval Ġtopic Message Channel Ġ= ĠTopic Message Channel ( client , Ġtopic Arn ) ĊĊĠ Ġoverride Ġfun Ġpublish Restricted Patient Removed ( pr isoner Number : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġnow Ġ= ĠLocalDateTime . now (). at Zone ( Zone Id . of (" Europe / L ondon ")). to Offset DateTime () ĊĠĠĠĠĠ Ġ. format ( DateTime Formatter . ISO _ OFFSET _ DATE _ TIME ) ĊĊĠĠĠ Ġval Ġdomain Event Ġ= ĠDomain Event ( ĊĠĠĠĠĠ ĠeventType Ġ= Ġ" restricted - pat ients . patient . removed ", ĊĠĠĠĠĠ Ġversion Ġ= Ġ 1 , ĊĠĠĠĠĠ Ġoccurred At Ġ= Ġnow , ĊĠĠĠĠĠ Ġpublished At Ġ= Ġnow , ĊĠĠĠĠĠ Ġdescription Ġ= Ġ" Pr isoner Ġno Ġlonger Ġa Ġrestricted Ġpatient ", ĊĠĠĠĠĠ Ġadditional Information Ġ= ĠRe stricted Patient Removed Additional Information ( pr isoner Number ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġval Ġpayload Ġ= Ġgson . toJson ( domain Event ) ĊĊĠĠĠ Ġtopic Template . convert And Send ( ĊĠĠĠĠĠ Ġtopic Message Channel , ĊĠĠĠĠĠ Ġpayload , ĊĠĠĠĠĠ Ġmap Of (" eventType " Ġto Ġdomain Event . eventType ) ĊĠĠĠ Ġ) ĊĠ Ġ} Ċ } Ċ