package Ġcom . t cc . booking hotel . domain . use case Ċ Ċ import Ġcom . t cc . booking hotel . domain . entity . Customer Ċ import Ġcom . t cc . booking hotel . domain . exception . Customer Registry Exception Ċ import Ġcom . t cc . booking hotel . domain . exception . Type Exception Ċ import Ġcom . t cc . booking hotel . domain . repository . Customer Repository Ċ import Ġorg . springframework . stereotype . Component Ċ Ċ @ Component Ċ class ĠRegister New Customer ( ĊĠĠĠ Ġprivate Ġval Ġcustomer Repository : ĠCustomer Repository , Ċ ) Ġ{ ĊĊĠĠĠ Ġsuspend Ġfun Ġexecute ( customer : ĠCustomer ): ĠCustomer Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( customer Repository . exists By Email ( customer . email )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠCustomer Registry Exception ( Type Exception . CUSTOMER _ REGISTR ATION , Ġ" CLIENT ĠAL READY ĠREG IST RED ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreturn Ġcustomer Repository . create ( customer ) ĊĠĠĠ Ġ} Ċ }