package servicerequest

import (
	"database/sql"
	"time"
)

// ServiceRequestDB merepresentasikan tabel order lab/radiologi
// TODO: Sesuaikan field dan tag `db` dengan tabel SIMRS Anda
type ServiceRequestDB struct {
	IdxOrder  int64          `db:"idxorder"`
	IdxDaftar int64          `db:"idxdaftar"`
	NoMR      sql.NullString `db:"nomr"`
	TglOrder  sql.NullTime   `db:"tgl_order"`
	KdOrder   sql.NullString `db:"kd_order"` // Kode pemeriksaan/tindakan yang diminta
}

type ServiceRequestSyncLog struct {
	IdxOrder         int64  `db:"idxorder"`
	ServiceRequestID string `db:"servicerequest_id"`
	RequestPayload   string `db:"request_payload"`
	ResponsePayload  string `db:"response_payload"`
	Status           string `db:"status"`
	ErrorMessage     string `db:"error_message"`
}

type ServiceRequestRadDB struct {
	ID          string         `db:"id"`
	JsonData    sql.NullString `db:"Json_data"`
	PatientIHS  sql.NullString `db:"Nomor_satusehat_pasien"`
	PatientName sql.NullString `db:"Nama_lengkap"`
	EncounterID sql.NullString `db:"IDXDAFTAR_satusehat"`
	CreatedAt   time.Time      `db:"Created_at"`
	RequesterID sql.NullString `db:"requester_id"`
	PerformerID sql.NullString `db:"performer_id"`
}

type ServiceRequestJson struct {
	Status   string `json:"status"`
	Intent   string `json:"intent"`
	Category []struct {
		Coding []struct {
			Code    string `json:"code"`
			Display string `json:"display"`
		} `json:"coding"`
	} `json:"category"`
	Code struct {
		Coding []struct {
			Code    string `json:"code"`
			Display string `json:"display"`
		} `json:"coding"`
	} `json:"code"`
	Requester struct {
		Reference string `json:"reference"`
	} `json:"requester"`
	Performer []struct {
		Reference string `json:"reference"`
		Display   string `json:"display"`
	} `json:"performer"`
	AuthoredOn string `json:"authoredOn"`
}
