feat(core): sgw-device-ui
This commit is contained in:
331
src/services/controller/typings.d.ts
vendored
Normal file
331
src/services/controller/typings.d.ts
vendored
Normal file
@@ -0,0 +1,331 @@
|
||||
/* eslint-disable */
|
||||
// 该文件由 OneAPI 自动生成,请勿手动修改!
|
||||
|
||||
declare namespace API {
|
||||
interface LoginRequestBody {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface LoginResponse {
|
||||
token?: string;
|
||||
}
|
||||
|
||||
// Thông tin 1 entity
|
||||
interface Entity {
|
||||
id: string;
|
||||
type: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
// Trigger điều kiện trong TCR
|
||||
interface Trigger {
|
||||
entityID: string;
|
||||
gt: number;
|
||||
lt: number;
|
||||
}
|
||||
|
||||
// Command thực thi trong TCR
|
||||
interface Command {
|
||||
to: string;
|
||||
params: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
// Cấu hình ngày/tuần/tháng/năm của TCR
|
||||
interface ActiveDay {
|
||||
activeDateRange: string[];
|
||||
dayInWeek: string[];
|
||||
dayInMonth: string[];
|
||||
deactiveInYear: string[];
|
||||
}
|
||||
|
||||
// TCR = Trigger Condition Rule
|
||||
interface TCR {
|
||||
id: string;
|
||||
enable: boolean;
|
||||
description: string;
|
||||
name: string;
|
||||
trigger: Trigger[];
|
||||
conditions: any[]; // chưa rõ cấu trúc nên tạm để any[]
|
||||
duration: number;
|
||||
commands: Command[];
|
||||
sendEvent: boolean;
|
||||
eventID: string;
|
||||
makeAlarm: string;
|
||||
alarmLevel: number;
|
||||
activeDay: ActiveDay;
|
||||
activeTime: number[]; // [start, end]
|
||||
}
|
||||
|
||||
// Sự kiện
|
||||
interface Event {
|
||||
evtid: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
// Node chính (mỗi thiết bị / sensor)
|
||||
interface Node {
|
||||
nid: string;
|
||||
subtype?: string; // có thể không có (ví dụ hum:0:21)
|
||||
enable: boolean;
|
||||
name: string;
|
||||
entities: Entity[];
|
||||
TCR?: TCR[]; // không phải node nào cũng có
|
||||
events?: Event[];
|
||||
}
|
||||
|
||||
// Response root
|
||||
interface NodeResponse {
|
||||
nodes: Node[];
|
||||
synced: boolean;
|
||||
}
|
||||
|
||||
interface EntityResponse {
|
||||
id: string;
|
||||
v: number;
|
||||
vs: string;
|
||||
t: number;
|
||||
type: string;
|
||||
}
|
||||
interface TransformedEntity {
|
||||
id: string;
|
||||
value: number;
|
||||
valueString: string;
|
||||
time: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface ShipDetail {
|
||||
id: string;
|
||||
thing_id: string;
|
||||
owner_id: string;
|
||||
name: string;
|
||||
ship_type: number;
|
||||
home_port: number;
|
||||
ship_length: number;
|
||||
ship_power: number;
|
||||
reg_number: string;
|
||||
imo_number: string;
|
||||
mmsi_number: string;
|
||||
fishing_license_number: string;
|
||||
fishing_license_expiry_date: Date;
|
||||
province_code: string;
|
||||
ship_group_id: string;
|
||||
created_at: Date;
|
||||
updated_at: Date;
|
||||
}
|
||||
|
||||
interface GPSResonse {
|
||||
lat: number;
|
||||
lon: number;
|
||||
s: number;
|
||||
h: number;
|
||||
fishing: boolean;
|
||||
}
|
||||
|
||||
// Trips
|
||||
interface FishingGear {
|
||||
name: string;
|
||||
number: string;
|
||||
}
|
||||
|
||||
interface TripCost {
|
||||
type: string;
|
||||
unit: string;
|
||||
amount: string;
|
||||
total_cost: string;
|
||||
cost_per_unit: string;
|
||||
}
|
||||
|
||||
interface TripCrewPerson {
|
||||
personal_id: string;
|
||||
name: string;
|
||||
phone: string;
|
||||
email: string;
|
||||
birth_date: Date; // ISO string (có thể chuyển sang Date nếu parse trước)
|
||||
note: string;
|
||||
address: string;
|
||||
created_at: Date;
|
||||
updated_at: Date;
|
||||
}
|
||||
|
||||
interface TripCrews {
|
||||
role: string;
|
||||
joined_at: Date;
|
||||
left_at: Date | null;
|
||||
note: string | null;
|
||||
Person: TripCrewPerson;
|
||||
}
|
||||
|
||||
interface FishingLogInfo {
|
||||
fish_species_id?: number;
|
||||
fish_name?: string;
|
||||
catch_number?: number;
|
||||
catch_unit?: string;
|
||||
fish_size?: number;
|
||||
fish_rarity?: number;
|
||||
fish_condition?: string;
|
||||
gear_usage?: string;
|
||||
}
|
||||
|
||||
interface FishingLog {
|
||||
fishing_log_id: string;
|
||||
trip_id: string;
|
||||
start_at: Date; // ISO datetime
|
||||
end_at: Date; // ISO datetime
|
||||
start_lat: number;
|
||||
start_lon: number;
|
||||
haul_lat: number;
|
||||
haul_lon: number;
|
||||
status: number;
|
||||
weather_description: string;
|
||||
info?: FishingLogInfo[];
|
||||
sync: boolean;
|
||||
}
|
||||
interface NewFishingLogRequest {
|
||||
trip_id: string;
|
||||
start_at: Date; // ISO datetime
|
||||
start_lat: number;
|
||||
start_lon: number;
|
||||
weather_description: string;
|
||||
}
|
||||
|
||||
interface Trip {
|
||||
id: string;
|
||||
ship_id: string;
|
||||
ship_length: number;
|
||||
vms_id: string;
|
||||
name: string;
|
||||
fishing_gears: FishingGear[];
|
||||
crews?: TripCrews[];
|
||||
departure_time: string; // ISO datetime string
|
||||
departure_port_id: number;
|
||||
arrival_time: string; // ISO datetime string
|
||||
arrival_port_id: number;
|
||||
fishing_ground_codes: number[];
|
||||
total_catch_weight: number | null;
|
||||
total_species_caught: number | null;
|
||||
trip_cost: TripCost[];
|
||||
trip_status: number;
|
||||
approved_by: string;
|
||||
notes: string | null;
|
||||
fishing_logs: FishingLog[] | null; // tuỳ dữ liệu chi tiết có thể định nghĩa thêm
|
||||
sync: boolean;
|
||||
}
|
||||
interface TripUpdateStateRequest {
|
||||
status: number;
|
||||
note?: string;
|
||||
}
|
||||
|
||||
interface Alarm {
|
||||
name: string;
|
||||
t: number; // timestamp (epoch seconds)
|
||||
level: number;
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface AlarmResponse {
|
||||
alarms: Alarm[];
|
||||
level: number;
|
||||
}
|
||||
|
||||
//Fish
|
||||
interface FishSpeciesResponse {
|
||||
id: number;
|
||||
name: string;
|
||||
scientific_name: string;
|
||||
group_name: string;
|
||||
species_code: string;
|
||||
note: string;
|
||||
default_unit: string;
|
||||
rarity_level: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
is_deleted: boolean;
|
||||
}
|
||||
interface FishRarity {
|
||||
id: number;
|
||||
code: string;
|
||||
label: string;
|
||||
description: string;
|
||||
iucn_code: any;
|
||||
cites_appendix: any;
|
||||
vn_law: boolean;
|
||||
}
|
||||
|
||||
// SOS
|
||||
|
||||
interface SosRequest {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
interface SosResponse {
|
||||
active: boolean;
|
||||
message?: string;
|
||||
started_at?: number;
|
||||
}
|
||||
|
||||
// Node
|
||||
interface Welcome {
|
||||
nodes?: Node[];
|
||||
synced?: boolean;
|
||||
}
|
||||
|
||||
interface Node {
|
||||
nid?: string;
|
||||
subtype?: string;
|
||||
enable?: boolean;
|
||||
name?: string;
|
||||
entities?: Entity[];
|
||||
TCR?: Tcr[];
|
||||
events?: Event[];
|
||||
}
|
||||
|
||||
interface Tcr {
|
||||
id?: string;
|
||||
enable?: boolean;
|
||||
description?: string;
|
||||
name?: string;
|
||||
trigger?: Trigger[];
|
||||
conditions?: any[];
|
||||
duration?: number;
|
||||
commands?: Command[];
|
||||
sendEvent?: boolean;
|
||||
eventID?: string;
|
||||
makeAlarm?: string;
|
||||
alarmLevel?: number;
|
||||
activeDay?: ActiveDay;
|
||||
activeTime?: number[];
|
||||
}
|
||||
|
||||
interface ActiveDay {
|
||||
activeDateRange?: any[];
|
||||
dayInWeek?: any[];
|
||||
dayInMonth?: any[];
|
||||
deactiveInYear?: any[];
|
||||
}
|
||||
|
||||
interface Command {
|
||||
to?: string;
|
||||
params?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface Trigger {
|
||||
entityID?: string;
|
||||
gt?: number;
|
||||
lt?: number;
|
||||
}
|
||||
|
||||
interface Entity {
|
||||
id?: string;
|
||||
type?: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface Event {
|
||||
evtid?: string;
|
||||
content?: string;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user