//
//  SharingData.swift
//  forShip
//
//  Created by Mamoru Sugita on 2023/10/20.
//
import Foundation
import CoreLocation

class SharingData: ObservableObject{
    static let shared = SharingData()
    
    class My {
        static var location: CLLocationCoordinate2D? = nil
        static var gps: CLLocationCoordinate2D? = nil
        static var server: CLLocationCoordinate2D? = nil
        static var speed: Double = 0.0
        static var course: Double = 0.0
        static var heading: Double = 0.0
        static var dataTime: String = "" //2023-11-02T05:25:49.4362123Z

        static var id: Int = 0
        static var shipId: Int = 0
        static var shipName: String = ""
        static var imo: Int = 0
        static var mmsi: Int = 0

        static func reset() {
            location = nil
            speed = 0.0
            course = 0.0
            heading = 0.0
        }
    }

    class Map {
        static var wayPoints: [CLLocationCoordinate2D] = []
        static var legLine: [CLLocationCoordinate2D] = []
        static var portLine: [CLLocationCoordinate2D] = []
        static var starboardLine: [CLLocationCoordinate2D] = []
    }

    class Message {
        static var mode: Int = 0   // 0:通常 , 1:Warning中
        static var messages: [message] = []
    }

    /**
     * Eca
     */
    @Published var ecaArea: Dictionary<String, RegisteredEca> = [:]
    
    func editEcaArea(key: String, value: RegisteredEca){
        ecaArea.updateValue(value, forKey: key)
    }
    
    
}
