// Package clinical mostly about SOAPI
package clinical

type (
	SubjectCode           string
	ObjectCode            string
	AssessmentCode        string
	PlanCode              string
	InstructionCode       string
	HeadToToeCode         string
	McuUrgencyLevelCode   string
	McuScopeCode          string
	SoapiTypeCode         string
	MedicalActionTypeCode string
	VehicleTypeCode       string
	GeneralEduCode        string
	SpecialEduCode        string
	EduAssessmentCode     string
	AbilityCode           string
	WillCode              string
	MedObstacleCode       string
	LearnMethodCode       string
	LangClassCode         string
	TranslatorSrcCode     string
	ScreeningFormTypeCode string
	SurgerySizeCode       string
	SurgerySystemCode     string
	SurgeryTypeCode       string
	SurgeryStageCode      string
	BornMortalityCode     string
	BornLocationCode      string
	SpecimentDestCode     string
	ProcedureReportType   string
)

const (
	SCDetail                SubjectCode = "detail"         // Detail
	SCPrimaryComplain       SubjectCode = "pri-complain"   // Keluhan Utama
	SCSecComplain           SubjectCode = "sec-complain"   // Secondary Complaint
	SCCurrentDiseaseHistory SubjectCode = "cur-disea-hist" // Current Disease History
	SCPastDiseaseHistory    SubjectCode = "pas-disea-hist" // Past Disease History
	SCFamilyDiseaseHistory  SubjectCode = "fam-disea-hist" // Family Disease History
	SCAllergyHistory        SubjectCode = "alg-hist"       // Allergic History
	SCAllergyReaction       SubjectCode = "alg-react"      // Allergic Reaction
	SCMedicationHistory     SubjectCode = "med-hist"       // Medication History
	SCBloodType             SubjectCode = "blood-type"     // Blood Type

	Detail                   ObjectCode = "detail"              // Detail
	OCConsciousnessLevel     ObjectCode = "consc-level"         // Tingkat Kesadaran
	OCConsciousnessLevelDet  ObjectCode = "consc-level-det"     // Detail Tingkat Kesadaran
	OCSystolicBloodPressure  ObjectCode = "syst-bp"             // Tekanan Darah Systolic
	OCDiastolicBloodPressure ObjectCode = "diast-bp"            // Tekanan Darah Diastolic
	OCPulse                  ObjectCode = "pulse"               // Nadi
	OCRespiratoryRate        ObjectCode = "resp-rate"           // Pernafasan
	OCHeartRate              ObjectCode = "hear-rt"             // Detak Jantung
	OCNeuroCranialis         ObjectCode = "neuro-cranialis"     // Neurologist Cranialist
	OCSensoris               ObjectCode = "sensoris"            // Sensoris
	OCReflectFisio           ObjectCode = "reflect-fisio"       // Refleks Fisiologi
	OCReflectPato            ObjectCode = "reflect-pato"        // Refleks Patologi
	OCAutonomNeuron          ObjectCode = "autonom-neuron"      // Saraf Otonom
	OCNeckRom                ObjectCode = "neck-rom"            // ROM Leher
	OCBodyRom                ObjectCode = "body-rom"            // ROM Batang Tubuh
	OCAgaRom                 ObjectCode = "aga-rom"             // ROM AGA
	OCAgbRom                 ObjectCode = "agb-rom"             // ROM AGB
	OCNeckMmt                ObjectCode = "neck-mmt"            // MMT Leher
	OCBodyMmt                ObjectCode = "body-mmt"            // MMT Batang Tubuh
	OCAgaMmt                 ObjectCode = "aga-mmt"             // MMT AGA
	OCAgbMmt                 ObjectCode = "agb-mmt"             // MMT AGB
	OCLocalis                ObjectCode = "localis"             // Status Lokalis
	OCMedicalTrouble         ObjectCode = "medical-trouble"     // Masalah Medis
	OCRehabMedicTrouble      ObjectCode = "rehab-medic-trouble" // Masalah Rehab Medik
	OCTemperature            ObjectCode = "temp"                // Suhu
	OCSpO2                   ObjectCode = "spo2"                // SpO2
	OCWeight                 ObjectCode = "weight"              // Berat Badan
	OCHeight                 ObjectCode = "height"              // Tinggi Badan
	OCHeadToToe              ObjectCode = "head-to-toe"         // Kepala Sampai Kaki

	ACDetail        AssessmentCode = "detail"          // Detail
	ACEarlyDiag     AssessmentCode = "early-diag"      // Diagnosis Awal
	ACLateDiag      AssessmentCode = "late-diag"       // Diagnosis Akhir
	ACSecDiag       AssessmentCode = "sec-diag"        // Diagnosis Sekunder
	ACEarlyMedDiag  AssessmentCode = "early-med-diag"  // Diagnosis Medis Awal
	ACLateMedDiag   AssessmentCode = "late-med-diag"   // Diagnosis Medis Akhir
	ACSecMedDiag    AssessmentCode = "sec-med-diag"    // Diagnosis Medis Sekunder
	ACEarlyFuncDiag AssessmentCode = "early-func-diag" // Diagnosis Fungsi Awal
	ACLateFuncDiag  AssessmentCode = "late-func-diag"  // Diagnosis Fungsi Akhir
	ACSecFuncDiag   AssessmentCode = "sec-func-diag"   // Diagnosis Fungsi Sekunder

	PCPlan PlanCode = "plan" // Rencana

	ICDetail     InstructionCode = "detail"          // Detail Instruksi
	ICMedAct     InstructionCode = "medical-act"     // Tindakan Medis
	ICSupExam    InstructionCode = "supporting-exam" // Pemeriksaan Penunjang
	ICTherapy    InstructionCode = "therapy"         // Terapi
	ICMedication InstructionCode = "medication"      // Obat
	ICMaterial   InstructionCode = "material"        // BMHP
	ICREhabProg  InstructionCode = "rehab-program"   // Program Rehab
	ICPhyMod     InstructionCode = "physic-modal"    // Modalitas Fisik
	ICExcercise  InstructionCode = "exercise"        // Latihan
	ICOrtPro     InstructionCode = "ortes-protesa"   // Ortesa Protesa
	ICEducation  InstructionCode = "education"       // Edukasi
	ICOther      InstructionCode = "other"           // Lain-lain

	HTTHead        HeadToToeCode = "head"
	HTTEye         HeadToToeCode = "eye"
	HTTEar         HeadToToeCode = "ear"
	HTTNose        HeadToToeCode = "nose"
	HTTMouthThroat HeadToToeCode = "mouth-throat"
	HTTHeadOthers  HeadToToeCode = "head-others"
	HTTThorax      HeadToToeCode = "thorax"
	HTTHeart       HeadToToeCode = "heart"
	HTTLung        HeadToToeCode = "lung"
	HTTAbdomen     HeadToToeCode = "abdomen"
	HTTLiver       HeadToToeCode = "liver"
	HTTBack        HeadToToeCode = "back"
	HTTEkstremitas HeadToToeCode = "ekstremitas"
	HTTGender      HeadToToeCode = "gender"
	HTTRectum      HeadToToeCode = "rectum"
	HTTNeuron      HeadToToeCode = "neuron"
	HTTBodyOthers  HeadToToeCode = "body-others"

	MULCCITO    McuUrgencyLevelCode = "cito"          // CITO
	MULCCITOIGD McuUrgencyLevelCode = "cito-igd"      // CITO IGD
	MULCPonek   McuUrgencyLevelCode = "ponek"         // PONEK
	MULCBG      McuUrgencyLevelCode = "blood-gas"     // Analisa Gas Darah
	MULCPF      McuUrgencyLevelCode = "priority-form" // Form Prioritas
	MULCRT      McuUrgencyLevelCode = "routine"       // Pemeriksaan Rutin

	STCEarlyNurse  SoapiTypeCode = "early-nursery" // Kajian Awal Keperawatan
	STCEEarlyMedic SoapiTypeCode = "early-medic"   // Kajian Awal Rehab Medis
	STCEarlyRehab  SoapiTypeCode = "early-rehab"   // Kajian Awal Rehab Medik
	STCFunc        SoapiTypeCode = "function"      // Assessment Fungsi
	STCProgress    SoapiTypeCode = "progress"      // CPPT
	STCDevRecord   SoapiTypeCode = "dev-record"    // Catatan Perkembangan
	STCKfrAdm      SoapiTypeCode = "kfr-adm"       // soapi untuk kfr
	STCKfrSeries   SoapiTypeCode = "kfr-series"    // soapi untuk kfr
	STCAmbResume   SoapiTypeCode = "amb-resume"    // Rajal resume

	MATCChemo      MedicalActionTypeCode = "chemo"
	MATCHemo       MedicalActionTypeCode = "hemo"
	MATCThalasemia MedicalActionTypeCode = "thalasemia"
	MATCEchocardio MedicalActionTypeCode = "echocardio"
	MATCSpirometry MedicalActionTypeCode = "spirometry"

	VTCAmbulance VehicleTypeCode = "ambulance" // Ambulans
	VTCTransport VehicleTypeCode = "transport" // Transport
	VTCHearse    VehicleTypeCode = "hearse"    // Jenazah

	GECRightObg           GeneralEduCode = "right-obg"            // Hak dan kewajiban pasien dan keluarga
	GECGeneralConsent     GeneralEduCode = "general-consent"      // General Consent
	GECService            GeneralEduCode = "service"              // Pelayanan yang disediakan (jam pelayanan, akses pelayanan dan proses pelayanan)
	GECAltCareSrc         GeneralEduCode = "alt-care-src"         // Sumber alternatif asuhan di tempat lain/faskes lain
	GECHomePlan           GeneralEduCode = "home-plan"            // Rencana tindakan di rumah
	GECHomeCare           GeneralEduCode = "home-care"            // Kebutuhan perawatan di rumah
	GECOrientation        GeneralEduCode = "orientation"          // Orientasi ruangan
	GECFallRiskPrevention GeneralEduCode = "fall-risk-prevention" // Pencegahan risiko jatuh
	GECAltCare            GeneralEduCode = "alt-care"             // Alternatif pelayanan
	GECActDelay           GeneralEduCode = "act-delay"            // Penundaan Tindakan
	GECOthers             GeneralEduCode = "others"               // Lain - lain

	SECDiseaseDiagDev SpecialEduCode = "disease-diag-dev" // Diagnosa penyakit dan perkembangannya
	SECSafeMedUsage   SpecialEduCode = "safe-med-usage"   // Penggunaan obat yang aman,
	SECSideEffect     SpecialEduCode = "side-effect"      // Efek samping dan reaksi obat
	SECDiet           SpecialEduCode = "diet"             // Diet/Nutrisi
	SECPainMgmt       SpecialEduCode = "pain-mgmt"        // Managemen nyeri
	SECMedicalEqUsage SpecialEduCode = "medical-eq-usage" // Penggunaan Peralatan Medis
	SECRehabTechnique SpecialEduCode = "rehab-technique"  // Teknik Rehabilitasi
	SECPreventionAct  SpecialEduCode = "prevention-act"   // Tindakan pencegahan (cuci tangan, pemasangan gelang)

	EACLearnAbility EduAssessmentCode = "learn-ability" // Kemampuan Belajar
	EACLearnWill    EduAssessmentCode = "learn-will"    // Kemauan Belajar
	EACObstacle     EduAssessmentCode = "obstacle"      // Hambatan
	EACLearnMethod  EduAssessmentCode = "learn-method"  // Metode Pembelajaran
	EACLang         EduAssessmentCode = "lang"          // Bahasa
	EACLangObstacle EduAssessmentCode = "lang-obstacle" // Hambatan Bahasa
	EACBelief       EduAssessmentCode = "belief"        // Keyakinan

	ACAble    AbilityCode = "able"     // Mampu
	ACNotAble AbilityCode = "not-able" // Tidak Mampu

	WCReady         WillCode = "ready"          // Siap
	WCInterested    WillCode = "interested"     // Tertarik
	WCNotInterested WillCode = "not-interested" // Tidak Tertarik

	MOCHearing   MedObstacleCode = "hearing"   // Pendengaran
	MOCSight     MedObstacleCode = "sight"     // Penglihatan
	MOCPhysical  MedObstacleCode = "physical"  // Fisik
	MOCEmotional MedObstacleCode = "emotional" // Emosional
	MOCCognitif  MedObstacleCode = "cognitif"  // Kognitif

	LMCDemo           LearnMethodCode = "demo"            // Demonstrasi
	LMCDiscussLeaflet LearnMethodCode = "discuss-leaflet" // Diskusi Leaflet

	LCCInd     LangClassCode = "ind"     // Indonesia
	LCCRegion  LangClassCode = "region"  // Daerah
	LCCForeign LangClassCode = "foreign" // Asing

	TSCTeam   TranslatorSrcCode = "team"   // Tim Penerjemah
	TSCFamily TranslatorSrcCode = "family" // Keluarga

	SFTCA        ScreeningFormTypeCode = "form-a" // Formu A
	SFTCB        ScreeningFormTypeCode = "form-b" // Formu B
	MSCRadiology McuScopeCode          = "radiology"
	MSCCpLab     McuScopeCode          = "cp-lab"
	MSCMicroLab  McuScopeCode          = "micro-lab"
	MSCApLab     McuScopeCode          = "ap-lab"

	SSCSmall   SurgerySizeCode = "small"
	SSCMedium  SurgerySizeCode = "medium"
	SSCLarge   SurgerySizeCode = "large"
	SSCSpecial SurgerySizeCode = "special"

	SSyCCito     SurgerySystemCode = "cito"
	SSyCUrgent   SurgerySystemCode = "urgent"
	SSyCEfective SurgerySystemCode = "efective"
	SSyCSpecial  SurgerySystemCode = "special"

	STCClean      SurgeryTypeCode = "clean"
	STCCleanCtm   SurgeryTypeCode = "clean-ctm"
	STCUncleanCtm SurgeryTypeCode = "unclean-ctm"
	STCUnclean    SurgeryTypeCode = "unclean"

	SStCFirst  SurgeryStageCode = "first"
	SStCRepeat SurgeryStageCode = "repeat"

	BMCAlive BornMortalityCode = "alive"
	BMCDead  BornMortalityCode = "dead"

	BLCExtMiw       BornLocationCode = "ext-miw"
	BLCExtDoc       BornLocationCode = "ext-doc"
	BLCTradMiw      BornLocationCode = "trad-miw"
	BLCLocalMed     BornLocationCode = "local-med"
	BLCExtParamedic BornLocationCode = "ext-paramedic"

	SDCAp    SpecimentDestCode = "ap"
	SDCMicro SpecimentDestCode = "micro"
	SDCLab   SpecimentDestCode = "lab"
	SDCNone  SpecimentDestCode = "none"

	PRTProcedure ProcedureReportType = "procedure"
	PRTSurgery   ProcedureReportType = "surgery"
)

type Soapi struct {
	Subject     SubjectSection     `json:"subject"`
	Object      ObjectSection      `json:"object"`
	Assessment  AssessmentSection  `json:"assessment"`
	Plan        string             `json:"plan"`
	Instruction InstructionSection `json:"instruction"`
}

// ---------------- SUBJECT ----------------
type SubjectSection struct {
	Detail                string `json:"detail,omitempty"`
	PrimComplain          string `json:"prim-compl,omitempty"`
	SecComplainQ          string `json:"sec-compl,omitempty"`
	PrimaryComplain       string `json:"pri-complain,omitempty"`
	SecondaryComplain     string `json:"sec-complain,omitempty"`
	CurrentDiseaseHistory string `json:"cur-disea-hist,omitempty"`
	PastDiseaseHistory    string `json:"pas-disea-hist,omitempty"`
	FamilyDiseaseHistory  string `json:"fam-disea-hist,omitempty"`
	AllergyHistory        string `json:"alg-hist,omitempty"`
	AllergyReaction       string `json:"alg-react,omitempty"`
	MedicationHistory     string `json:"med-hist,omitempty"`
	BloodType             string `json:"blood-type,omitempty"`
}

// ---------------- OBJECT ----------------
type ObjectSection struct {
	Detail                 string    `json:"detail,omitempty"`
	ConsciousnessLevel     string    `json:"consc-level,omitempty"`
	ConsciousnessLevelDet  string    `json:"consc-level-det,omitempty"`
	SystolicBloodPressure  string    `json:"syst-bp,omitempty"`
	DiastolicBloodPressure string    `json:"diast-bp,omitempty"`
	Pulse                  string    `json:"pulse,omitempty"`
	RespiratoryRate        string    `json:"resp-rate,omitempty"`
	HeartRate              string    `json:"hear-rt,omitempty"`
	NeuroCranialis         string    `json:"neuro-cranialis,omitempty"`
	Sensoris               string    `json:"sensoris,omitempty"`
	ReflectFisio           string    `json:"reflect-fisio,omitempty"`
	ReflectPato            string    `json:"reflect-pato,omitempty"`
	AutonomNeuron          string    `json:"autonom-neuron,omitempty"`
	NeckRom                string    `json:"neck-rom,omitempty"`
	BodyRom                string    `json:"body-rom,omitempty"`
	AgaRom                 string    `json:"aga-rom,omitempty"`
	AgbRom                 string    `json:"agb-rom,omitempty"`
	NeckMmt                string    `json:"neck-mmt,omitempty"`
	BodyMmt                string    `json:"body-mmt,omitempty"`
	AgaMmt                 string    `json:"aga-mmt,omitempty"`
	AgbMmt                 string    `json:"agb-mmt,omitempty"`
	Localis                string    `json:"localis,omitempty"`
	MedicalTrouble         string    `json:"medical-trouble,omitempty"`
	RehabMedicTrouble      string    `json:"rehab-medic-trouble,omitempty"`
	Temperature            string    `json:"temp,omitempty"`
	SpO2                   string    `json:"spo2,omitempty"`
	Weight                 string    `json:"weight,omitempty"`
	Height                 string    `json:"height,omitempty"`
	HeadToToe              HeadToToe `json:"head-to-toe,omitempty"`
}

// ---------------- ASSESSMENT ----------------
type AssessmentSection struct {
	Detail                 string          `json:"detail,omitempty"`
	EarlyDiagnosis         DiagnosisDetail `json:"early-diag,omitempty"`
	LateDiagnosis          DiagnosisDetail `json:"late-diag,omitempty"`
	SecondaryDiag          DiagnosisDetail `json:"sec-diag,omitempty"`
	EarlyDiagnosisMed      DiagnosisDetail `json:"early-med-diag,omitempty"`
	LateDiagnosisMed       DiagnosisDetail `json:"late-med-diag,omitempty"`
	SecondaryDiagnosisMed  DiagnosisDetail `json:"sec-med-diag,omitempty"`
	EarlyDiagnosisFunc     DiagnosisDetail `json:"early-func-diag,omitempty"`
	LateDiagnosisFunc      DiagnosisDetail `json:"late-func-diag,omitempty"`
	SecondaryDiagnosisFunc DiagnosisDetail `json:"sec-func-diag,omitempty"`
}

// nested object {note, codes}
type DiagnosisDetail struct {
	Note  string         `json:"note,omitempty"`
	Codes []CodeWithName `json:"codes,omitempty"`
}

// ---------------- INSTRUCTION ----------------
type InstructionSection struct {
	Detail          string         `json:"detail,omitempty"`
	MedicalAction   CodesWithNote  `json:"medical-act,omitempty"`
	SupportingExam  []CodeWithName `json:"supporting-exam,omitempty"`
	Therapy         string         `json:"therapy,omitempty"`
	Medication      []CodeWithName `json:"medication,omitempty"`
	Material        []CodeWithName `json:"material,omitempty"`
	RehabProgram    string         `json:"rehab-program,omitempty"`
	PhysicModal     string         `json:"physic-modal,omitempty"`
	Exercise        string         `json:"exercise,omitempty"`
	OrtesProsthesis string         `json:"ortes-protesa,omitempty"`
	Education       string         `json:"education,omitempty"`
	Other           string         `json:"other,omitempty"`
}

// ---------------- CODES ----------------
type CodeWithName struct {
	Code string `json:"code,omitempty"`
	Name string `json:"name,omitempty"`
}
type CodesWithNote struct {
	Note  string         `json:"note,omitempty"`
	Codes []CodeWithName `json:"codes,omitempty"`
}

type HeadToToe struct {
	Head        string `json:"head,omitempty"`
	Eye         string `json:"eye,omitempty"`
	Ear         string `json:"ear,omitempty"`
	Nose        string `json:"nose,omitempty"`
	MouthThroat string `json:"mouth-throat,omitempty"`
	HeadOthers  string `json:"head-others,omitempty"`
	Thorax      string `json:"thorax,omitempty"`
	Heart       string `json:"heart,omitempty"`
	Lung        string `json:"lung,omitempty"`
	Abdomen     string `json:"abdomen,omitempty"`
	Liver       string `json:"liver,omitempty"`
	Back        string `json:"back,omitempty"`
	Ekstremitas string `json:"ekstremitas,omitempty"`
	Gender      string `json:"gender,omitempty"`
	Rectum      string `json:"rectum,omitempty"`
	Neuron      string `json:"neuron,omitempty"`
	BodyOthers  string `json:"body-others,omitempty"`
}

type ProcedureRecord struct {
	Procedures []CodeWithName `json:"procedures"`
}

type ProcedureExecution struct {
	SurgerySize_Code      *string  `json:"surgerySize_code"`
	Billing_Code          *string  `json:"billing_code"`
	SurgerySystem_Code    *string  `json:"surgerySystem_code"`
	StartAt               *string  `json:"startAt"`
	EndAt                 *string  `json:"endAt"`
	AnesthesiaStartAt     *string  `json:"anesthesiaStartAt"`
	AnesthesiaEndAt       *string  `json:"anesthesiaEndAt"`
	SurgeryType_Code      *string  `json:"surgeryType_code"`
	SurgeryStage_Code     *string  `json:"surgeryStage_code"`
	BornMortality_Code    *string  `json:"bornMortality_code"`
	BornLocation_Code     *string  `json:"bornLocation_code"`
	Weight                *string  `json:"weight"`
	BornNotes             *string  `json:"bornNotes" gorm:"size:1024"`
	Description           *string  `json:"notes" gorm:"size:1024"`
	BleedingAmount        *uint16  `json:"bleedingAmount"`
	BloodInType_Code      *string  `json:"bloodInType_code"`
	BloodInAmount         *uint16  `json:"bloodInAmount"`
	Brand                 *string  `json:"brand" gorm:"size:100"`
	ImplantName           *string  `json:"implantName" gorm:"size:100"`
	ImplantRegisterNumber *string  `json:"implantRegisterNumber" gorm:"size:100"`
	ImplantCompanionName  *string  `json:"implantCompanionName" gorm:"size:100"`
	SpecimentDest_Code    *string  `json:"specimentDest" gorm:"size:100"`
	TissueInfo            []string `json:"tissueInfo" gorm:"size:100"`
}

type SoapiSrc struct {
	Id      string `json:"id,omitempty"`
	Code    string `json:"code,omitempty"`
	Name    string `json:"name,omitempty"`
	IndName string `json:"indName,omitempty"`
}

type EarlyMedicValue struct {
	Vaccinated             bool       `json:"vaccinated,omitempty"`
	CaseStatus             string     `json:"case-status,omitempty"`
	EncounterStatus        string     `json:"encounter-status,omitempty"`
	PrimaryComplain        string     `json:"pri-complain,omitempty"`
	CurrentDiseaseHistory  string     `json:"cur-disea-hist,omitempty"`
	SpO2                   int        `json:"spo2,omitempty"`
	SystolicBloodPressure  int        `json:"syst-bp,omitempty"`
	DiastolicBloodPressure int        `json:"diast-bp,omitempty"`
	RespiratoryRate        int        `json:"resp-rate,omitempty"`
	Pulse                  int        `json:"pulse,omitempty"`
	Weight                 int        `json:"weight,omitempty"`
	BloodType              string     `json:"blood-type,omitempty"`
	Temperature            int        `json:"temp,omitempty"`
	Height                 int        `json:"height,omitempty"`
	PhysicalExamination    string     `json:"physical-exam,omitempty"`
	DiagnoseSrc            []SoapiSrc `json:"diagnoseSrc,omitempty"`
	ProcedureSrc           []SoapiSrc `json:"procedureSrc,omitempty"`
	EarlyMedicDiagnose     string     `json:"early-med-diag,omitempty"`
	EarlyMedicPlan         string     `json:"early-med-plan,omitempty"`
	Therapy                string     `json:"therapy,omitempty"`
	ExpectedOutcome        []SoapiSrc `json:"expected-outcome,omitempty"`
}
