//
//  PenguinModel.swift
//  Runner
//
//  Created by Amir  on 06/08/2024.
//

import Foundation

// Define the model class
struct PenguinModel {
    let baseURL: String
    let dataURL: String
    let dataServiceName: String
    let positionURL: String
    let clientKey: String
    let storyboardName: String
    let mapBoxKey: String
    let clientID: String
    let positionServiceName: String

    // Initialize the model from a dictionary
    init?(from dictionary: [String: Any]) {
        guard
            let baseURL = dictionary["baseURL"] as? String,
            let dataURL = dictionary["dataURL"] as? String,
            let dataServiceName = dictionary["dataServiceName"] as? String,
            let positionURL = dictionary["positionURL"] as? String,
            let clientKey = dictionary["clientKey"] as? String,
            let storyboardName = dictionary["storyboardName"] as? String,
            let mapBoxKey = dictionary["mapBoxKey"] as? String,
            let clientID = dictionary["clientID"] as? String,
            let positionServiceName = dictionary["positionServiceName"] as? String
        else {
            return nil
        }

        self.baseURL = baseURL
        self.dataURL = dataURL
        self.dataServiceName = dataServiceName
        self.positionURL = positionURL
        self.clientKey = clientKey
        self.storyboardName = storyboardName
        self.mapBoxKey = mapBoxKey
        self.clientID = clientID
        self.positionServiceName = positionServiceName
    }
}
