package afterflightinspection import ( "errors" "time" "gorm.io/gorm" "wucher/internal/shared/pkg/uuidv7" ) type AfterFlightInspection struct { ID []byte `gorm:"type:binary(16);primaryKey;column:id"` FlightInspectionID []byte `gorm:"type:binary(16);not null;uniqueIndex;column:flight_inspection_id"` OilEngineNR1Checked *string `gorm:"type:varchar(255);null;column:oil_engine_nr1_checked"` OilEngineNR2Checked *string `gorm:"type:varchar(255);null;column:oil_engine_nr2_checked"` HydraulicLHChecked *string `gorm:"type:varchar(255);null;column:hydraulic_lh_checked"` HydraulicRHChecked *string `gorm:"type:varchar(255);null;column:hydraulic_rh_checked"` OilTransmissionMGBChecked *string `gorm:"type:varchar(255);null;column:oil_transmission_mgb_checked"` OilTransmissionIGBChecked *string `gorm:"type:varchar(255);null;column:oil_transmission_igb_checked"` OilTransmissionTGBChecked *string `gorm:"type:varchar(255);null;column:oil_transmission_tgb_checked"` Note *string `gorm:"type:text;column:note"` CreatedAt time.Time `gorm:"column:created_at"` CreatedBy []byte `gorm:"type:binary(16);column:created_by"` UpdatedAt time.Time `gorm:"column:updated_at"` UpdatedBy []byte `gorm:"type:binary(16);column:updated_by"` } func (AfterFlightInspection) TableName() string { return "after_flight_inspections" } func (a *AfterFlightInspection) BeforeCreate(tx *gorm.DB) error { if len(a.ID) == 0 { a.ID = uuidv7.MustBytes() } return nil } var ( ErrInvalidFlightInspectionID = errors.New("flight_inspection_id is invalid") ErrFlightInspectionNotFound = errors.New("flight inspection not found") ErrCapabilitiesUnavailable = errors.New("helicopter capabilities could not be resolved") ErrNR1Required = errors.New("oil_engine_nr1_checked is required for this helicopter") ErrNR1NotAvailable = errors.New("NR1 capability not available on this helicopter") ErrNR2Required = errors.New("oil_engine_nr2_checked is required for this helicopter") ErrNR2NotAvailable = errors.New("NR2 capability not available on this helicopter") ErrLHRequired = errors.New("hydraulic_lh_checked is required for this helicopter") ErrLHNotAvailable = errors.New("LH capability not available on this helicopter") ErrRHRequired = errors.New("hydraulic_rh_checked is required for this helicopter") ErrRHNotAvailable = errors.New("RH capability not available on this helicopter") ErrMGBRequired = errors.New("oil_transmission_mgb_checked is required for this helicopter") ErrMGBNotAvailable = errors.New("MGB capability not available on this helicopter") ErrIGBRequired = errors.New("oil_transmission_igb_checked is required for this helicopter") ErrIGBNotAvailable = errors.New("IGB capability not available on this helicopter") ErrTGBRequired = errors.New("oil_transmission_tgb_checked is required for this helicopter") ErrTGBNotAvailable = errors.New("TGB capability not available on this helicopter") )