Skip to content

Commit

Permalink
feat(entities): add getControlUnitResourceCategoryFromType() util
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Jan 24, 2024
1 parent bba2809 commit c9a8545
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/entities/Administration.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ControlUnit } from './ControlUnit'
import type { ControlUnit } from './ControlUnit/types'

export namespace Administration {
export interface Administration {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Mission } from './Mission'
import { Mission } from '../Mission'

import type { Administration } from './Administration'
import type { DepartmentArea } from './DepartmentArea'
import type { Station } from './Station'
import type { Administration } from '../Administration'
import type { DepartmentArea } from '../DepartmentArea'
import type { Station } from '../Station'

export namespace ControlUnit {
export interface ControlUnit {
Expand Down
41 changes: 41 additions & 0 deletions src/entities/ControlUnit/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { ControlUnit } from './types'

export function getControlUnitResourceCategoryFromType(
type: ControlUnit.ControlUnitResourceType
): ControlUnit.ControlUnitResourceCategory | undefined {
switch (type) {
case ControlUnit.ControlUnitResourceType.CAR:
case ControlUnit.ControlUnitResourceType.EQUESTRIAN:
case ControlUnit.ControlUnitResourceType.MOTORCYCLE:
case ControlUnit.ControlUnitResourceType.PEDESTRIAN:
return ControlUnit.ControlUnitResourceCategory.LAND

case ControlUnit.ControlUnitResourceType.AIRPLANE:
case ControlUnit.ControlUnitResourceType.DRONE:
case ControlUnit.ControlUnitResourceType.HELICOPTER:
return ControlUnit.ControlUnitResourceCategory.AIR

case ControlUnit.ControlUnitResourceType.BARGE:
case ControlUnit.ControlUnitResourceType.FAST_BOAT:
case ControlUnit.ControlUnitResourceType.FRIGATE:
case ControlUnit.ControlUnitResourceType.HYDROGRAPHIC_SHIP:
case ControlUnit.ControlUnitResourceType.KAYAK:
case ControlUnit.ControlUnitResourceType.LIGHT_FAST_BOAT:
case ControlUnit.ControlUnitResourceType.MINE_DIVER:
case ControlUnit.ControlUnitResourceType.NET_LIFTER:
case ControlUnit.ControlUnitResourceType.PATROL_BOAT:
case ControlUnit.ControlUnitResourceType.PIROGUE:
case ControlUnit.ControlUnitResourceType.RIGID_HULL:
case ControlUnit.ControlUnitResourceType.SEA_SCOOTER:
case ControlUnit.ControlUnitResourceType.SEMI_RIGID:
case ControlUnit.ControlUnitResourceType.SUPPORT_SHIP:
case ControlUnit.ControlUnitResourceType.TRAINING_SHIP:
case ControlUnit.ControlUnitResourceType.TUGBOAT:
return ControlUnit.ControlUnitResourceCategory.SEA

case ControlUnit.ControlUnitResourceType.NO_RESOURCE:
case ControlUnit.ControlUnitResourceType.OTHER:
default:
return undefined
}
}
2 changes: 1 addition & 1 deletion src/entities/Station.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { ControlUnit } from './ControlUnit'
import type { ControlUnit } from './ControlUnit/types'

export namespace Station {
export interface Station {
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export { ExclamationPoint } from './symbols/ExclamationPoint'
*/

export type { Administration } from './entities/Administration'
export { ControlUnit } from './entities/ControlUnit'
export { ControlUnit } from './entities/ControlUnit/types'
export { getControlUnitResourceCategoryFromType } from './entities/ControlUnit/utils'
export type { DepartmentArea } from './entities/DepartmentArea'
export { Mission } from './entities/Mission'
export type { Station } from './entities/Station'
Expand Down

0 comments on commit c9a8545

Please sign in to comment.