165 lines
3.3 KiB
TypeScript
165 lines
3.3 KiB
TypeScript
declare namespace Model {
|
|
interface LoginRequestBody {
|
|
username: string;
|
|
password: string;
|
|
}
|
|
interface LoginResponse {
|
|
token?: string;
|
|
}
|
|
|
|
interface GPSResonse {
|
|
lat: number;
|
|
lon: number;
|
|
s: number;
|
|
h: number;
|
|
fishing: boolean;
|
|
}
|
|
interface Alarm {
|
|
name: string;
|
|
t: number; // timestamp (epoch seconds)
|
|
level: number;
|
|
id: string;
|
|
}
|
|
|
|
interface AlarmResponse {
|
|
alarms: Alarm[];
|
|
level: number;
|
|
}
|
|
|
|
interface ShipTrackPoint {
|
|
time: number;
|
|
lon: number;
|
|
lat: number;
|
|
s: number;
|
|
h: number;
|
|
}
|
|
interface EntityResponse {
|
|
id: string;
|
|
v: number;
|
|
vs: string;
|
|
t: number;
|
|
type: string;
|
|
}
|
|
interface TransformedEntity {
|
|
id: string;
|
|
value: number;
|
|
valueString: string;
|
|
time: number;
|
|
type: string;
|
|
}
|
|
|
|
// Banzones
|
|
// Banzone
|
|
export interface Zone {
|
|
id?: string;
|
|
name?: string;
|
|
type?: number;
|
|
conditions?: Condition[];
|
|
enabled?: boolean;
|
|
updated_at?: Date;
|
|
geom?: Geom;
|
|
}
|
|
|
|
export interface Condition {
|
|
max?: number;
|
|
min?: number;
|
|
type?: Type;
|
|
to?: number;
|
|
from?: number;
|
|
}
|
|
|
|
export enum Type {
|
|
LengthLimit = "length_limit",
|
|
MonthRange = "month_range",
|
|
}
|
|
|
|
export interface Geom {
|
|
geom_type?: number;
|
|
geom_poly?: string;
|
|
geom_lines?: string;
|
|
geom_point?: string;
|
|
geom_radius?: number;
|
|
}
|
|
|
|
interface SosRequest {
|
|
message?: string;
|
|
}
|
|
|
|
interface SosResponse {
|
|
active: boolean;
|
|
message?: string;
|
|
started_at?: number;
|
|
}
|
|
// Trip
|
|
interface Trip {
|
|
id: string;
|
|
ship_id: string;
|
|
ship_length: number;
|
|
vms_id: string;
|
|
name: string;
|
|
fishing_gears: FishingGear[]; // Dụng cụ đánh cá
|
|
crews?: TripCrews[]; // Thuyền viên
|
|
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[]; // Chi phí chuyến đi
|
|
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;
|
|
}
|
|
|
|
// Dụng cụ đánh cá
|
|
interface FishingGear {
|
|
name: string;
|
|
number: string;
|
|
}
|
|
// Thuyền viên
|
|
interface TripCrews {
|
|
role: string;
|
|
joined_at: Date;
|
|
left_at: Date | null;
|
|
note: string | null;
|
|
Person: TripCrewPerson;
|
|
}
|
|
// Chi phí chuyến đi
|
|
interface TripCost {
|
|
type: string;
|
|
unit: string;
|
|
amount: string;
|
|
total_cost: string;
|
|
cost_per_unit: string;
|
|
}
|
|
// Thông tin mẻ lưới
|
|
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[]; // Thông tin cá
|
|
sync: boolean;
|
|
}
|
|
// Thông tin cá
|
|
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;
|
|
}
|
|
}
|