package Ġuk . gov . just ice . digital . h mp ps . h mp ps inter vention ss ervice . dto Ċ Ċ import Ġcom . fasterxml . jackson . annotation . Json Creator Ċ import Ġcom . fasterxml . jackson . annotation . JsonProperty Ċ import Ġuk . gov . just ice . digital . h mp ps . h mp ps inter vention ss ervice . jpa . entity . Appointment Delivery Type Ċ import Ġuk . gov . just ice . digital . h mp ps . h mp ps inter vention ss ervice . jpa . entity . Appointment Session Type Ċ import Ġuk . gov . just ice . digital . h mp ps . h mp ps inter vention ss ervice . jpa . entity . At tended Ċ import Ġuk . gov . just ice . digital . h mp ps . h mp ps inter vention ss ervice . jpa . entity . Auth User Ċ import Ġuk . gov . just ice . digital . h mp ps . h mp ps inter vention ss ervice . jpa . entity . Delivery Session Ċ import Ġjava . time . Offset DateTime Ċ import Ġjava . util . UUID Ċ Ċ data Ġclass ĠAddress DTO Ġprivate Ġconstructor ( ĊĠ Ġval Ġfirst Address Line : ĠString , ĊĠ Ġval Ġsecond Address Line : ĠString ? Ġ= Ġnull , ĊĠ Ġval Ġtown Or City : ĠString ? Ġ= Ġnull , ĊĠ Ġval Ġcount y : ĠString ? Ġ= Ġnull , ĊĠ Ġval Ġpost Code : ĠString , Ċ ) Ġ{ ĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġ@ Json Creator ĊĠĠĠ Ġoperator Ġfun Ġinvoke ( first Address Line : ĠString , Ġsecond Address Line : ĠString ? Ġ= Ġnull , Ġtown Or City : ĠString ? Ġ= Ġnull , Ġcount y : ĠString ? Ġ= Ġnull , Ġpost Code : ĠString ): ĠAddress DTO Ġ{ ĊĠĠĠĠĠ Ġval Ġnormalized PostCode Ġ= Ġpost Code . replace ("\\ s ". to Regex (), Ġ""). uppercase () ĊĠĠĠĠĠ Ġreturn ĠAddress DTO ( first Address Line , Ġsecond Address Line , Ġtown Or City , Ġcount y , Ġnormalized PostCode ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ data Ġclass ĠUpdate Appointment DTO ( ĊĠ Ġval Ġappointment Time : ĠOffset DateTime , ĊĠ Ġ@ JsonProperty ( required Ġ= Ġtrue ) Ġval Ġduration In Minutes : ĠInt , ĊĠ Ġval Ġappointment Delivery Type : ĠAppointment Delivery Type , ĊĠ Ġval Ġsession Type : ĠAppointment Session Type ? Ġ= Ġnull , ĊĠ Ġval Ġappointment Delivery Address : ĠAddress DTO ? Ġ= Ġnull , ĊĠ Ġval Ġn ps Office Code : ĠString ? Ġ= Ġnull , Ċ ) Ċ Ċ data Ġclass ĠUpdate Appointment Attendance DTO ( ĊĠ Ġval Ġat tended : ĠAtt ended , ĊĠ Ġval Ġadditional Attendance Information : ĠString ? Ċ ) Ċ Ċ data Ġclass ĠRecord Appointment Behaviour DTO ( ĊĠ Ġval Ġbehaviour Description : ĠString , ĊĠ Ġval Ġnotify Prob ation Pract itioner : ĠBoolean , Ċ ) Ċ Ċ data Ġclass ĠDelivery Session DTO ( ĊĠ Ġval Ġid : ĠUUID , ĊĠ Ġval Ġsession Number : ĠInt , ĊĠ Ġval Ġappointment Time : ĠOffset DateTime ?, ĊĠ Ġval Ġduration In Minutes : ĠInt ?, ĊĠ Ġval Ġappointment Delivery Type : ĠAppointment Delivery Type ?, ĊĠ Ġval Ġsession Type : ĠAppointment Session Type ?, ĊĠ Ġval Ġn ps Office Code : ĠString ?, ĊĠ Ġval Ġappointment Delivery Address : ĠAddress DTO ?, ĊĠ Ġval Ġsession Feedback : ĠSession Feedback DTO , Ċ ) Ġ{ ĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġfun Ġfrom ( session : ĠDelivery Session ): ĠDelivery Session DTO Ġ{ ĊĠĠĠĠĠ Ġval Ġappointment Delivery Ġ= Ġsession . current Appointment ?. appointment Delivery ĊĠĠĠĠĠ Ġval Ġaddress Ġ= Ġwhen Ġ( appointment Delivery ?. appointment Delivery Type ) Ġ{ ĊĠĠĠĠĠĠĠ ĠAppointment Delivery Type . IN _ PERSON _ ME ET ING _ OTHER Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġif Ġ( appointment Delivery ?. appointment Delivery Address Ġ!== Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġaddress Ġ= Ġappointment Delivery . appointment Delivery Address ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( address Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠAddress DTO ( address . first Address Line , Ġaddress . second Address Line Ġ?: Ġ"", Ġaddress . town City , Ġaddress . county , Ġaddress . post Code ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġnull ĊĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġnull ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġelse Ġ-> Ġnull ĊĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠ Ġreturn ĠDelivery Session DTO ( ĊĠĠĠĠĠĠĠ Ġid Ġ= Ġsession . id , ĊĠĠĠĠĠĠĠ Ġsession Number Ġ= Ġsession . session Number , ĊĠĠĠĠĠĠĠ Ġappointment Time Ġ= Ġsession . current Appointment ?. appointment Time , ĊĠĠĠĠĠĠĠ Ġduration In Minutes Ġ= Ġsession . current Appointment ?. duration In Minutes , ĊĠĠĠĠĠĠĠ Ġappointment Delivery Type Ġ= Ġsession . current Appointment ?. appointment Delivery ?. appointment Delivery Type , ĊĠĠĠĠĠĠĠ Ġsession Type Ġ= Ġsession . current Appointment ?. appointment Delivery ?. appointment Session Type , ĊĠĠĠĠĠĠĠ Ġappointment Delivery Address Ġ= Ġaddress , ĊĠĠĠĠĠĠĠ Ġn ps Office Code Ġ= Ġsession . current Appointment ?. appointment Delivery ?. n ps Office Code , ĊĠĠĠĠĠĠĠ Ġsession Feedback Ġ= ĠSession Feedback DTO . from ( ĊĠĠĠĠĠĠĠĠĠ Ġsession . current Appointment ?. at tended , ĊĠĠĠĠĠĠĠĠĠ Ġsession . current Appointment ?. additional Attendance Information , ĊĠĠĠĠĠĠĠĠĠ Ġsession . current Appointment ?. attendance Behaviour , ĊĠĠĠĠĠĠĠĠĠ Ġsession . current Appointment ?. notify PP Of Attendance Behaviour , ĊĠĠĠĠĠĠĠĠĠ Ġsession . current Appointment ?. appointment Feedback Submitted At Ġ!= Ġnull , ĊĠĠĠĠĠĠĠĠĠ Ġsession . current Appointment ?. appointment Feedback Submitted By , ĊĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġfun Ġfrom ( sessions : ĠList < Delivery Session >): ĠList < Delivery Session DTO > Ġ{ ĊĠĠĠĠĠ Ġreturn Ġsessions . map Ġ{ Ġfrom ( it ) Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ data Ġclass ĠSession Feedback DTO ( ĊĠ Ġval Ġatt endance : ĠAtt endance DTO , ĊĠ Ġval Ġbehaviour : ĠBe haviour DTO , ĊĠ Ġval Ġsubmitted : ĠBoolean , ĊĠ Ġval Ġsubmitted By : ĠAuth User DTO ?, Ċ ) Ġ{ ĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġfun Ġfrom ( ĊĠĠĠĠĠ Ġat tended : ĠAtt ended ?, ĊĠĠĠĠĠ Ġadditional Attendance Information : ĠString ?, ĊĠĠĠĠĠ Ġbehaviour Description : ĠString ?, ĊĠĠĠĠĠ Ġnotify Prob ation Pract itioner : ĠBoolean ?, ĊĠĠĠĠĠ Ġsubmitted : ĠBoolean , ĊĠĠĠĠĠ Ġsubmitted By : ĠAuth User ?, ĊĠĠĠ Ġ): ĠSession Feedback DTO Ġ{ ĊĠĠĠĠĠ Ġreturn ĠSession Feedback DTO ( ĊĠĠĠĠĠĠĠ ĠAtt endance DTO ( at tended Ġ= Ġat tended , Ġadditional Attendance Information Ġ= Ġadditional Attendance Information ), ĊĠĠĠĠĠĠĠ ĠBe haviour DTO ( be haviour Description , Ġnotify Prob ation Pract itioner ), ĊĠĠĠĠĠĠĠ Ġsubmitted , ĊĠĠĠĠĠĠĠ Ġsubmitted By ?. let Ġ{ ĠAuth User DTO . from ( it ) Ġ}, ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ data Ġclass ĠAtt endance DTO ( ĊĠ Ġval Ġat tended : ĠAtt ended ?, ĊĠ Ġval Ġadditional Attendance Information : ĠString ?, Ċ ) Ċ Ċ data Ġclass ĠBe haviour DTO ( ĊĠ Ġval Ġbehaviour Description : ĠString ?, ĊĠ Ġval Ġnotify Prob ation Pract itioner : ĠBoolean ?, Ċ ) Ċ