//
//  
//  UserCallModel.swift
//  WoWonder
//
//  Created by Mohammed Hamad on 06/09/2022.
//  Copyright © 2022 ScriptSun. All rights reserved.
//
//
import Foundation
import UIKit

struct UserCallModel: Codable {
    
    var id : String?
    var from_id : String?
    var to_id : String?
    var type : String?
    var room_name : String?
    var time : String?
    var status : String?
    var active : String?
    var called : String?
    var declined : String?
    var url : String?
    var access_token : String?
    var access_token_2 : String?
    
    enum CodingKeys: String, CodingKey {
        case id = "id"
        case from_id = "from_id"
        case to_id = "to_id"
        case type = "type"
        case room_name = "room_name"
        case time = "time"
        case status = "status"
        case active = "active"
        case called = "called"
        case declined = "declined"
        case url = "url"
        case access_token = "access_token"
        case access_token_2 = "access_token_2"
    }
    
    init() {
        
    }
    
    init(from decoder: Decoder) throws {
        let values = try decoder.container(keyedBy: CodingKeys.self)
        if let id = try? values.decode(String.self, forKey: .id) {
            self.id = id
        }
        if let from_id = try? values.decode(String.self, forKey: .from_id) {
            self.from_id = from_id
        }
        if let to_id = try? values.decode(String.self, forKey: .to_id) {
            self.to_id = to_id
        }
        if let type = try? values.decode(String.self, forKey: .type) {
            self.type = type
        }
        if let room_name = try? values.decode(String.self, forKey: .room_name) {
            self.room_name = room_name
        }
        if let time = try? values.decode(String.self, forKey: .time) {
            self.time = time
        }
        if let status = try? values.decode(String.self, forKey: .status) {
            self.status = status
        }
        if let active = try? values.decode(String.self, forKey: .active) {
            self.active = active
        }
        if let called = try? values.decode(String.self, forKey: .called) {
            self.called = called
        }
        if let declined = try? values.decode(String.self, forKey: .declined) {
            self.declined = declined
        }
        if let url = try? values.decode(String.self, forKey: .url) {
            self.url = url
        }
        if let access_token = try? values.decode(String.self, forKey: .access_token) {
            self.access_token = access_token
        }
        if let access_token_2 = try? values.decode(String.self, forKey: .access_token_2) {
            self.access_token_2 = access_token_2
        }
    }
    
}
