Files
leistungsbilanz-ts/src/frontend/types.ts
T
2026-07-23 21:56:13 +02:00

302 lines
6.7 KiB
TypeScript

export interface ProjectDto {
id: string;
name: string;
singlePhaseVoltageV: number;
threePhaseVoltageV: number;
currentRevision: number;
}
export interface ProjectHistoryStateDto {
projectId: string;
currentRevision: number;
undoDepth: number;
redoDepth: number;
undoChangeSetId: string | null;
redoChangeSetId: string | null;
}
export interface ProjectCommandDto {
schemaVersion: number;
type: string;
payload: unknown;
}
export interface ProjectCommandResultDto {
revision: {
revisionId: string;
changeSetId: string;
projectId: string;
revisionNumber: number;
createdAtIso: string;
};
history: ProjectHistoryStateDto;
}
export interface DistributionBoardDto {
id: string;
projectId: string;
name: string;
}
export interface CircuitListDto {
id: string;
projectId: string;
distributionBoardId: string;
name: string;
}
export interface FloorDto {
id: string;
projectId: string;
name: string;
sortOrder: number;
}
export interface RoomDto {
id: string;
projectId: string;
floorId: string | null;
roomNumber: string;
roomName: string;
}
export interface GlobalDeviceDto {
id: string;
name: string;
displayName: string;
category: string | null;
quantity: number;
installedPowerPerUnitKw: number;
demandFactor: number;
voltageV: number | null;
phaseCount: 1 | 3 | null;
powerFactor: number | null;
note: string | null;
}
export interface ProjectDeviceDto {
id: string;
projectId: string;
name: string;
displayName: string;
phaseType: "single_phase" | "three_phase";
connectionKind: string | null;
costGroup: string | null;
category: string | null;
quantity: number;
powerPerUnit: number;
simultaneityFactor: number;
totalPower: number;
cosPhi: number | null;
remark: string | null;
voltageV: number | null;
}
export interface CreateFloorInput {
name: string;
}
export interface CreateRoomInput {
floorId?: string;
roomNumber: string;
roomName: string;
}
export interface CreateGlobalDeviceInput {
name: string;
displayName: string;
category?: string;
quantity: number;
installedPowerPerUnitKw: number;
demandFactor: number;
voltageV?: number;
phaseCount?: 1 | 3;
powerFactor?: number;
note?: string;
}
export interface CreateProjectDeviceInput {
name: string;
displayName: string;
phaseType: "single_phase" | "three_phase";
connectionKind?: string;
costGroup?: string;
category?: string;
quantity: number;
powerPerUnit: number;
simultaneityFactor: number;
cosPhi?: number;
remark?: string;
voltageV?: number;
}
export interface ProjectDeviceSyncDifferenceDto {
field: ProjectDeviceSyncField;
currentValue: string | number | null;
sourceValue: string | number | null;
isOverridden: boolean;
}
export interface ProjectDeviceSyncRowDto {
rowId: string;
circuitId: string;
equipmentIdentifier: string;
circuitDisplayName: string | null;
circuitListId: string;
circuitListName: string;
distributionBoardId: string;
distributionBoardName: string;
rowDisplayName: string;
overriddenFields: ProjectDeviceSyncField[];
differences: ProjectDeviceSyncDifferenceDto[];
}
export interface ProjectDeviceSyncPreviewDto {
projectDevice: {
id: string;
name: string;
displayName: string;
};
rows: ProjectDeviceSyncRowDto[];
}
export interface ProjectDeviceSyncRestoreRowDto {
rowId: string;
values: Partial<Record<ProjectDeviceSyncField, string | number | null>>;
overriddenFields: ProjectDeviceSyncField[];
}
export interface ProjectDeviceSyncResultDto {
preview: ProjectDeviceSyncPreviewDto;
undo: {
rows: ProjectDeviceSyncRestoreRowDto[];
};
}
export interface ProjectDeviceDisconnectResultDto {
disconnectedRowIds: string[];
undo: {
rowIds: string[];
};
}
export interface CircuitTreeDeviceRowDto {
id: string;
linkedProjectDeviceId?: string;
legacyConsumerId?: string;
sortOrder: number;
name: string;
displayName: string;
phaseType?: string;
connectionKind?: string;
costGroup?: string;
category?: string;
level?: string;
roomId?: string;
roomNumberSnapshot?: string;
roomNameSnapshot?: string;
quantity: number;
powerPerUnit: number;
simultaneityFactor: number;
cosPhi?: number;
remark?: string;
overriddenFields?: string;
rowTotalPower: number;
}
export interface CircuitTreeCircuitDto {
id: string;
circuitListId: string;
sectionId: string;
equipmentIdentifier: string;
displayName?: string;
sortOrder: number;
protectionType?: string;
protectionRatedCurrent?: number;
protectionCharacteristic?: string;
cableType?: string;
cableCrossSection?: string;
cableLength?: number;
rcdAssignment?: string;
terminalDesignation?: string;
voltage?: number;
controlRequirement?: string;
status?: string;
isReserve: boolean;
remark?: string;
circuitTotalPower: number;
deviceRows: CircuitTreeDeviceRowDto[];
}
export interface CircuitTreeSectionDto {
id: string;
key: string;
displayName: string;
prefix: string;
sortOrder: number;
circuits: CircuitTreeCircuitDto[];
}
export interface CircuitTreeMigrationReportDto {
circuitListId: string;
legacyConsumerCount: number;
createdCircuitCount: number;
createdDeviceRowCount: number;
groupedDuplicateCircuitNumbers: Array<{ normalizedCircuitNumber: string; count: number }>;
generatedIdentifiers: string[];
unassignedRows: Array<{ consumerId: string; reason: string }>;
warnings: string[];
}
export interface CircuitTreeResponseDto {
circuitListId: string;
sections: CircuitTreeSectionDto[];
migrationReport?: CircuitTreeMigrationReportDto;
}
export interface CreateCircuitInputDto {
sectionId: string;
equipmentIdentifier: string;
displayName?: string;
sortOrder: number;
protectionType?: string;
protectionRatedCurrent?: number;
protectionCharacteristic?: string;
cableType?: string;
cableCrossSection?: string;
cableLength?: number;
rcdAssignment?: string;
terminalDesignation?: string;
voltage?: number;
controlRequirement?: string;
status?: string;
isReserve?: boolean;
remark?: string;
}
export type UpdateCircuitInputDto = Partial<CreateCircuitInputDto>;
export interface CreateCircuitDeviceRowInputDto {
linkedProjectDeviceId?: string;
name: string;
displayName: string;
phaseType?: string;
connectionKind?: string;
costGroup?: string;
category?: string;
level?: string;
roomId?: string;
roomNumberSnapshot?: string;
roomNameSnapshot?: string;
quantity: number;
powerPerUnit: number;
simultaneityFactor: number;
cosPhi?: number;
remark?: string;
overriddenFields?: string;
sortOrder?: number;
}
export type UpdateCircuitDeviceRowInputDto = Partial<CreateCircuitDeviceRowInputDto>;
import type { ProjectDeviceSyncField } from "../shared/constants/project-device-sync-fields";