stillbox/pkg/incidents/incident.go

39 lines
1 KiB
Go
Raw Normal View History

2024-12-28 18:32:13 -05:00
package incidents
import (
2024-12-29 09:30:24 -05:00
"encoding/json"
2025-01-29 21:14:13 -05:00
"strings"
2024-12-29 09:30:24 -05:00
2024-12-28 18:32:13 -05:00
"dynatron.me/x/stillbox/internal/jsontypes"
2024-12-29 09:30:24 -05:00
"dynatron.me/x/stillbox/pkg/calls"
"dynatron.me/x/stillbox/pkg/rbac/entities"
"dynatron.me/x/stillbox/pkg/users"
2024-12-28 18:32:13 -05:00
"github.com/google/uuid"
)
type Incident struct {
ID uuid.UUID `json:"id"`
Owner users.UserID `json:"owner"`
2024-12-28 18:32:13 -05:00
Name string `json:"name"`
Description *string `json:"description"`
StartTime *jsontypes.Time `json:"startTime"`
EndTime *jsontypes.Time `json:"endTime"`
Location jsontypes.Location `json:"location"`
Metadata jsontypes.Metadata `json:"metadata"`
2024-12-29 09:30:24 -05:00
Calls []IncidentCall `json:"calls"`
}
func (inc *Incident) GetResourceName() string {
return entities.ResourceIncident
}
2025-01-29 21:14:13 -05:00
func (inc *Incident) PlaylistFilename() string {
rep := strings.NewReplacer(" ", "_", "/", "_", ":", "_")
return rep.Replace(strings.ToLower(inc.Name))
}
2024-12-29 09:30:24 -05:00
type IncidentCall struct {
calls.Call
Notes json.RawMessage `json:"notes"`
2024-12-28 18:32:13 -05:00
}