package entities import ( "time" "gorm.io/gorm" ) type DailyChecklist struct { Id uint `gorm:"primaryKey"` KandangId uint `gorm:"not null"` ChecklistId *uint Date time.Time `gorm:"type:date;not null"` Name *string `gorm:"type:varchar(255)"` Status *string `gorm:"type:varchar(255)"` Category string `gorm:"type:category_code;not null"` TotalScore *int DocumentPath *string RejectReason *string CreatedBy *uint DeletedBy *uint CreatedAt time.Time `gorm:"autoCreateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Kandang KandangGroup `gorm:"foreignKey:KandangId;references:Id"` Checklist *Checklist `gorm:"foreignKey:ChecklistId;references:Id"` Creator *User `gorm:"foreignKey:CreatedBy;references:Id"` Deleter *User `gorm:"foreignKey:DeletedBy;references:Id"` Tasks []DailyChecklistTask `gorm:"foreignKey:DailyChecklistId;references:Id"` EmptyKandang *DailyChecklistEmptyKandang `gorm:"foreignKey:DailyChecklistId;references:Id"` } type DailyChecklistPhase struct { Id uint `gorm:"primaryKey"` ChecklistId uint `gorm:"not null"` PhaseId uint `gorm:"not null"` CreatedAt time.Time `gorm:"autoCreateTime"` Checklist Checklist `gorm:"foreignKey:ChecklistId;references:Id"` Phase Phases `gorm:"foreignKey:PhaseId;references:Id"` } type DailyChecklistActivityTask struct { Id uint `gorm:"primaryKey"` ChecklistId uint `gorm:"not null"` PhaseId uint `gorm:"not null"` PhaseActivityId uint `gorm:"not null"` TimeType *string `gorm:"type:text"` Notes *string `gorm:"type:text"` CreatedAt time.Time `gorm:"autoCreateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"` Checklist DailyChecklist `gorm:"foreignKey:ChecklistId;references:Id"` Phase Phases `gorm:"foreignKey:PhaseId;references:Id"` PhaseActivity PhaseActivity `gorm:"foreignKey:PhaseActivityId;references:Id"` Assignments []DailyChecklistActivityTaskAssignment `gorm:"foreignKey:TaskId;references:Id"` } type DailyChecklistActivityTaskAssignment struct { Id uint `gorm:"primaryKey"` TaskId uint `gorm:"not null"` EmployeeId uint `gorm:"not null"` Checked bool `gorm:"not null;default:false"` Note *string `gorm:"type:text"` CreatedAt time.Time `gorm:"autoCreateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"` Task DailyChecklistActivityTask `gorm:"foreignKey:TaskId;references:Id"` Employee Employee `gorm:"foreignKey:EmployeeId;references:Id"` } type DailyChecklistTask struct { Id uint `gorm:"primaryKey"` DailyChecklistId uint `gorm:"not null"` ChecklistId uint `gorm:"not null"` ChecklistItemId *uint IsCompleted bool `gorm:"not null;default:false"` ScoreValue *int Notes *string `gorm:"type:text"` PhotoProof *string Status *string CreatedAt time.Time `gorm:"autoCreateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"` DailyChecklist *DailyChecklist `gorm:"foreignKey:DailyChecklistId;references:Id"` Checklist Checklist `gorm:"foreignKey:ChecklistId;references:Id"` ChecklistItem *PhaseActivity `gorm:"foreignKey:ChecklistItemId;references:Id"` }