package model import ( "time" "gorm.io/gorm" "whiteboxsystems.nl/openkvpoc/openkv" "whiteboxsystems.nl/openkvpoc/sharedmodel" ) type ConnectionState string const ( ConnectionStatePending = ConnectionState("pending") ConnectionStateCompleted = ConnectionState("completed") ) type Connection struct { gorm.Model Reference string AuthConfigID uint AuthConfig *sharedmodel.AuthConfig State ConnectionState Addr string Supplier string System string Services []Service } type Service struct { gorm.Model ConnectionID uint Connection *Connection `json:"Connection,omitempty"` ServiceID string Name string Description string SubscriptionPolicy openkv.SubscriptionPolicy ConsentPolicy openkv.ConsentPolicy AuthConfigID uint AuthConfig *sharedmodel.AuthConfig Subscriptions []Patient `gorm:"many2many:service_patients;"` } type Consent struct { gorm.Model ConnectionID uint ServiceID string PatientID uint `json:"-"` Patient Patient `json:"-"` ConsentGivenOn *time.Time VerbalConsent bool Brochure string Brochureversion string } type Patient struct { gorm.Model ExternalId string ExternalIdSystem string Name string Birthdate string PatientID string FileBase string Consent []Consent }