Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Core/Resgrid.Model/CommandDefinitionRole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ public class CommandDefinitionRole : IEntity

public bool ForceRequirements { get; set; }

/// <summary>
/// The type of ICS lane/node this role maps to on the runtime command board
/// (e.g. Division, Group, Branch, Staging). Backs §3.2 CommandStructureNode seeding.
/// </summary>
public int LaneType { get; set; }

/// <summary>
/// Display/ordering position of this lane within the command definition.
/// </summary>
public int SortOrder { get; set; }

public virtual ICollection<CommandDefinitionRoleUnitType> RequiredUnitTypes { get; set; }

public virtual ICollection<CommandDefinitionRoleCert> RequiredCerts { get; set; }
Expand Down
1 change: 1 addition & 0 deletions Core/Resgrid.Model/CqrsEventTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ public enum CqrsEventTypes
PaddleSubscriptionUpdated = 19,
PaddleSubscriptionCanceled = 20,
PaddleSubscriptionCreated = 21,
IncidentCommandUpdated = 22,
}
}
12 changes: 11 additions & 1 deletion Core/Resgrid.Model/DepartmentVoiceChannel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;

Expand Down Expand Up @@ -26,6 +27,15 @@ public class DepartmentVoiceChannel : IEntity

public bool IsDefault { get; set; }

/// <summary>When set, this is an on-demand tactical channel scoped to a specific Call/incident (§3.4).</summary>
public int? CallId { get; set; }

/// <summary>True for IC-created on-demand incident channels (vs. standing department channels).</summary>
public bool IsOnDemand { get; set; }

/// <summary>When the on-demand incident channel was closed (soft-close at incident close).</summary>
public DateTime? ClosedOn { get; set; }

[NotMapped]
[JsonIgnore]
public object IdValue
Expand Down
96 changes: 96 additions & 0 deletions Core/Resgrid.Model/Events/IncidentCommandEvents.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
namespace Resgrid.Model.Events
{
/// <summary>Raised when command is established on an incident (§3.12 workflow trigger).</summary>
public class CommandEstablishedEvent
{
public int DepartmentId { get; set; }
public int CallId { get; set; }
public string IncidentCommandId { get; set; }
public string EstablishedByUserId { get; set; }
}

/// <summary>Raised when command is transferred to another user.</summary>
public class CommandTransferredEvent
{
public int DepartmentId { get; set; }
public int CallId { get; set; }
public string IncidentCommandId { get; set; }
public string FromUserId { get; set; }
public string ToUserId { get; set; }
}

/// <summary>Raised when a tactical objective / benchmark is completed.</summary>
public class IncidentObjectiveCompletedEvent
{
public int DepartmentId { get; set; }
public int CallId { get; set; }
public string IncidentCommandId { get; set; }
public string TacticalObjectiveId { get; set; }
public string Name { get; set; }
}

/// <summary>Raised when command is closed on an incident.</summary>
public class IncidentClosedEvent
{
public int DepartmentId { get; set; }
public int CallId { get; set; }
public string IncidentCommandId { get; set; }
}

/// <summary>Raised when a resource is assigned to a command structure node.</summary>
public class IncidentResourceAssignedEvent
{
public int DepartmentId { get; set; }
public int CallId { get; set; }
public string IncidentCommandId { get; set; }
public int ResourceKind { get; set; }
public string ResourceId { get; set; }
}

/// <summary>Raised when a resource is released from an incident.</summary>
public class IncidentResourceReleasedEvent
{
public int DepartmentId { get; set; }
public int CallId { get; set; }
public string ResourceAssignmentId { get; set; }
}

/// <summary>Raised when a user is assigned a functional incident role.</summary>
public class IncidentRoleAssignedEvent
{
public int DepartmentId { get; set; }
public int CallId { get; set; }
public string UserId { get; set; }
public int RoleType { get; set; }
}

/// <summary>Raised when an ad-hoc resource is created for an incident.</summary>
public class AdHocResourceCreatedEvent
{
public int DepartmentId { get; set; }
public int CallId { get; set; }
public string ResourceId { get; set; }
public string Name { get; set; }
public string Kind { get; set; }
}

/// <summary>Raised when an on-demand tactical voice channel is opened for an incident.</summary>
public class IncidentChannelOpenedEvent
{
public int DepartmentId { get; set; }
public int CallId { get; set; }
public string DepartmentVoiceChannelId { get; set; }
public string Name { get; set; }
}

/// <summary>
/// Raised when personnel accountability reaches a critical state (PAR overdue). No firing point yet — a PAR
/// evaluation worker would raise this; included so departments can configure workflows for it.
/// </summary>
public class CriticalParDetectedEvent
{
public int DepartmentId { get; set; }
public int CallId { get; set; }
public string UserId { get; set; }
}
}
27 changes: 27 additions & 0 deletions Core/Resgrid.Model/IncidentCommand/AssignableResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace Resgrid.Model
{
/// <summary>
/// A resource (unit or person) that the Commander can assign to a lane — sourced from the own department
/// or a linked (mutual-aid) department. Color-coded per the mutual-aid link.
/// </summary>
public class AssignableResource
{
/// <summary>Maps to <see cref="ResourceAssignmentKind"/> (RealUnit/RealPersonnel/LinkedDeptUnit/LinkedDeptPersonnel).</summary>
public int ResourceKind { get; set; }

/// <summary>Unit id (as string) or personnel user id.</summary>
public string ResourceId { get; set; }

/// <summary>Display name of the unit or person.</summary>
public string Name { get; set; }

/// <summary>The department this resource belongs to.</summary>
public int DepartmentId { get; set; }

/// <summary>True when the resource comes from a linked (mutual-aid) department.</summary>
public bool IsMutualAid { get; set; }

/// <summary>Map/marker color from the mutual-aid link (null for own-department resources).</summary>
public string Color { get; set; }
}
}
108 changes: 108 additions & 0 deletions Core/Resgrid.Model/IncidentCommand/CommandStructureNode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;

namespace Resgrid.Model
{
/// <summary>
/// A live lane / span-of-control node on the command board (Division, Group, Branch, Staging, ...).
/// Initially seeded from a <c>CommandDefinitionRole</c> then per-incident editable.
/// </summary>
public class CommandStructureNode : IEntity
{
public string CommandStructureNodeId { get; set; }

public string IncidentCommandId { get; set; }

public int DepartmentId { get; set; }

public int CallId { get; set; }

/// <summary>Maps to <see cref="CommandNodeType"/>.</summary>
public int NodeType { get; set; }

public string Name { get; set; }

/// <summary>Parent node for branch/division/group hierarchies; null for top-level nodes.</summary>
public string ParentNodeId { get; set; }

public string SupervisorUserId { get; set; }

public int? SupervisorUnitId { get; set; }

public int SortOrder { get; set; }

/// <summary>The CommandDefinitionRole this node was seeded from, if any.</summary>
public int? SourceRoleId { get; set; }

[NotMapped]
public string TableName => "CommandStructureNodes";

[NotMapped]
public string IdName => "CommandStructureNodeId";

[NotMapped]
public int IdType => 1;

[NotMapped]
[JsonIgnore]
public object IdValue
{
get { return CommandStructureNodeId; }
set { CommandStructureNodeId = (string)value; }
}

[NotMapped]
public IEnumerable<string> IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
}

/// <summary>
/// Assigns a resource to a command structure node. Polymorphic: the resource may be an own-department
/// unit/person, a linked (mutual-aid) department unit/person, or an incident ad-hoc unit/person.
/// </summary>
public class ResourceAssignment : IEntity
{
public string ResourceAssignmentId { get; set; }

public string IncidentCommandId { get; set; }

public int DepartmentId { get; set; }

public int CallId { get; set; }

public string CommandStructureNodeId { get; set; }

/// <summary>Maps to <see cref="ResourceAssignmentKind"/>.</summary>
public int ResourceKind { get; set; }

/// <summary>Polymorphic resource id (unit id, user id, or ad-hoc guid) stored as string.</summary>
public string ResourceId { get; set; }

public string AssignedByUserId { get; set; }

public DateTime AssignedOn { get; set; }

public DateTime? ReleasedOn { get; set; }

[NotMapped]
public string TableName => "ResourceAssignments";

[NotMapped]
public string IdName => "ResourceAssignmentId";

[NotMapped]
public int IdType => 1;

[NotMapped]
[JsonIgnore]
public object IdValue
{
get { return ResourceAssignmentId; }
set { ResourceAssignmentId = (string)value; }
}

[NotMapped]
public IEnumerable<string> IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
}
}
111 changes: 111 additions & 0 deletions Core/Resgrid.Model/IncidentCommand/IncidentAdHocResources.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;

namespace Resgrid.Model
{
/// <summary>
/// An incident-scoped, ad-hoc unit created on the fly for resources not in Resgrid (e.g. a mutual-aid
/// crew from a non-Resgrid agency, or a unit formed from on-scene personnel). Not a real department Unit.
/// </summary>
public class IncidentAdHocUnit : IEntity
{
public string IncidentAdHocUnitId { get; set; }

public int DepartmentId { get; set; }

public int CallId { get; set; }

public string Name { get; set; }

/// <summary>Optional reference to a department UnitType for classification.</summary>
public int? UnitTypeId { get; set; }

/// <summary>Free-text unit type (e.g. "Engine", "Ambulance") when no UnitTypeId applies.</summary>
public string Type { get; set; }

/// <summary>Name of the external (non-Resgrid) agency this resource belongs to, if any.</summary>
public string ExternalAgencyName { get; set; }

public string CreatedByUserId { get; set; }

public DateTime CreatedOn { get; set; }

public DateTime? ReleasedOn { get; set; }

[NotMapped]
public string TableName => "IncidentAdHocUnits";

[NotMapped]
public string IdName => "IncidentAdHocUnitId";

[NotMapped]
public int IdType => 1;

[NotMapped]
[JsonIgnore]
public object IdValue
{
get { return IncidentAdHocUnitId; }
set { IncidentAdHocUnitId = (string)value; }
}

[NotMapped]
public IEnumerable<string> IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
}

/// <summary>
/// An incident-scoped, ad-hoc person created on the fly for resources not in Resgrid. May ride an ad-hoc
/// (or real) unit for accountability via <see cref="RidingResourceKind"/> + <see cref="RidingResourceId"/>.
/// </summary>
public class IncidentAdHocPersonnel : IEntity
{
public string IncidentAdHocPersonnelId { get; set; }

public int DepartmentId { get; set; }

public int CallId { get; set; }

public string Name { get; set; }

/// <summary>Role / qualification (e.g. "Paramedic", "Firefighter").</summary>
public string Role { get; set; }

public string ExternalAgencyName { get; set; }

public string Contact { get; set; }

/// <summary>The kind of unit this person is riding for accountability (maps to <see cref="ResourceAssignmentKind"/>).</summary>
public int RidingResourceKind { get; set; }

/// <summary>Identifier of the unit this person is riding (ad-hoc unit id, real unit id, ...), or null.</summary>
public string RidingResourceId { get; set; }

public string CreatedByUserId { get; set; }

public DateTime CreatedOn { get; set; }

public DateTime? ReleasedOn { get; set; }

[NotMapped]
public string TableName => "IncidentAdHocPersonnel";

[NotMapped]
public string IdName => "IncidentAdHocPersonnelId";

[NotMapped]
public int IdType => 1;

[NotMapped]
[JsonIgnore]
public object IdValue
{
get { return IncidentAdHocPersonnelId; }
set { IncidentAdHocPersonnelId = (string)value; }
}

[NotMapped]
public IEnumerable<string> IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
}
}
Loading
Loading