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"
|
2025-01-22 10:39:23 -05:00
|
|
|
"dynatron.me/x/stillbox/pkg/rbac/entities"
|
2025-01-18 17:22:08 -05:00
|
|
|
"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"`
|
2025-01-18 17:22:08 -05:00
|
|
|
Owner users.UserID `json:"owner"`
|
2024-12-28 18:32:13 -05:00
|
|
|
Name string `json:"name"`
|
2025-01-29 22:29:21 -05:00
|
|
|
Description *string `json:"description,omitempty"`
|
|
|
|
StartTime *jsontypes.Time `json:"startTime,omitempty"`
|
|
|
|
EndTime *jsontypes.Time `json:"endTime,omitempty"`
|
|
|
|
Location jsontypes.Location `json:"location,omitempty"`
|
|
|
|
Metadata jsontypes.Metadata `json:"metadata,omitempty"`
|
2024-12-29 09:30:24 -05:00
|
|
|
Calls []IncidentCall `json:"calls"`
|
|
|
|
}
|
|
|
|
|
2025-01-18 17:22:08 -05:00
|
|
|
func (inc *Incident) GetResourceName() string {
|
2025-01-22 10:39:23 -05:00
|
|
|
return entities.ResourceIncident
|
2025-01-18 17:22:08 -05:00
|
|
|
}
|
|
|
|
|
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
|
2025-01-29 22:29:21 -05:00
|
|
|
Notes json.RawMessage `json:"notes,omitempty"`
|
2024-12-28 18:32:13 -05:00
|
|
|
}
|