import { Station } from "../../generated/client";
import { PublicUser } from "./User";

export interface MissionVehicleLog {
	type: "vehicle-log";
	auto: true;
	timeStamp: string;
	data: {
		vehicleName: string;
		oldStatus: string;
		newStatus: string;
	};
}

export interface MissionStationLog {
	type: "station-log";
	auto: true;
	timeStamp: string;
	data: {
		stationId: number;
		oldFMSstatus: string;
		newFMSstatus: string;
		station: Station;
		user: PublicUser;
	};
}

export interface MissionSdsLog {
	type: "sds-log";
	auto: false;
	timeStamp: string;
	data: {
		station: Station;
		user: PublicUser;
		stationId: number;
		message: string;
	};
}

export interface MissionMessageLog {
	type: "message-log";
	auto: false;
	timeStamp: string;

	data: {
		message: string;
		user: PublicUser;
	};
}

export interface MissionAlertLog {
	type: "alert-log";
	auto: false;
	timeStamp: string;
	data: {
		station?: Station;
		vehicle?: string;
		user: PublicUser;
	};
}
export interface MissionAlertLogAuto {
	type: "alert-log";
	auto: true;
	timeStamp: string;
}

export interface MissionCompletedLog {
	type: "completed-log";
	auto: boolean;
	timeStamp: string;
	data: {
		user?: PublicUser;
	};
}

export interface MissionReopenedLog {
	type: "reopened-log";
	auto: false;
	timeStamp: string;
	data: {
		user?: PublicUser;
	};
}

export type MissionLog =
	| MissionStationLog
	| MissionMessageLog
	| MissionSdsLog
	| MissionAlertLog
	| MissionAlertLogAuto
	| MissionCompletedLog
	| MissionVehicleLog
	| MissionReopenedLog;
