package Ġcom . r 3 . cord a . lib . chat . workflows . flows Ċ Ċ import Ġco . parallel universe . fib ers . Suspend able Ċ import Ġcom . r 3 . cord a . lib . chat . contracts . states . Chat ID Ċ import Ġcom . r 3 . cord a . lib . chat . contracts . states . Chat Meta Info Ċ import Ġcom . r 3 . cord a . lib . chat . workflows . flows . internal . Close Messages Flow Ċ import Ġcom . r 3 . cord a . lib . chat . workflows . flows . internal . Update Re ceiv ers Flow Ċ import Ġcom . r 3 . cord a . lib . chat . workflows . flows . utils . chat Vault Service Ċ import Ġnet . cord a . core . contracts . State And Ref Ċ import Ġnet . cord a . core . contracts . Unique Identifier Ċ import Ġnet . cord a . core . contracts . require That Ċ import Ġnet . cord a . core . flows .* Ċ import Ġnet . cord a . core . identity . Party Ċ import Ġnet . cord a . core . transactions . Signed Transaction Ċ import Ġnet . cord a . core . utilities . unwrap Ċ Ċ @ Initi ating Flow Ċ @ Start able By Service Ċ @ Start able By RPC Ċ class ĠRemove Participants Flow ( ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġchat Id : ĠUnique Identifier , ĊĠĠĠĠĠĠĠ Ġprivate Ġval Ġto Remove : ĠList < Party > Ċ ) Ġ: ĠFlow Logic < State And Ref < Chat Meta Info >>() Ġ{ ĊĠĠĠ Ġ@ Suspend able ĊĠĠĠ Ġoverride Ġfun Ġcall (): ĠState And Ref < Chat Meta Info > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġmeta Info State Ref Ġ= Ġchat Vault Service . get Meta Info OrNull ( chat Id ) ĊĠĠĠĠĠĠĠ Ġrequire ( meta Info State Ref Ġ!= Ġnull ) Ġ{ Ġ" Chat Id Ġmust Ġexist ." Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġmeta Info Ġ= Ġmeta Info State Ref !!. state . data ĊĠĠĠĠĠĠĠ Ġrequire That Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Only Ġchat Ġadmin Ġcan Ġremove Ġparticipants Ġfrom Ġchat ." Ġusing Ġ( our Identity Ġ== Ġmeta Info . admin ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ// Ġclose Ġall Ġmessages Ġfrom Ġother Ġsides ĊĠĠĠĠĠĠĠ Ġto Remove . map Ġ{ Ġinitiate Flow ( it ). send ( chat Id ) Ġ} ĊĊĠĠĠĠĠĠĠ Ġ// Ġupdate Ġthe Ġreceiv ers Ġfor Ġremaining ĊĠĠĠĠĠĠĠ Ġreturn Ġsub Flow ( Update Re ceiv ers Flow ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġchat Id Ġ= Ġchat Id , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġto Remove Ġ= Ġto Remove ĊĠĠĠĠĠĠĠ Ġ)) ĊĠĠĠ Ġ} Ċ } Ċ Ċ @ Initi ated By ( Remove Participants Flow :: class ) Ċ class ĠRemove Participants Flow Responder ( private Ġval Ġother Session : ĠFlow Session ) Ġ: ĠFlow Logic < Signed Transaction >() Ġ{ ĊĠĠĠ Ġ@ Suspend able ĊĠĠĠ Ġoverride Ġfun Ġcall (): ĠSigned Transaction Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġchat Id Ġ= Ġother Session . receive < Chat ID >(). unwrap Ġ{ Ġit Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġsub Flow ( Close Messages Flow ( chat Id )) ĊĠĠĠ Ġ} Ċ } Ċ