import Foundation
import RealmSwift

public class VehicleAd: Object, Decodable, Cloneable {
    @objc public dynamic var id: Int = 0
    @objc public dynamic var url: String?
    @objc public dynamic var price: String?
    @objc public dynamic var date: TimeInterval = Date().timeIntervalSince1970
    @objc public dynamic var mileage: String?
    @objc public dynamic var region: String?
    @objc public dynamic var city: String?
    @objc public dynamic var adDescription: String?
    public var photos = List<String>()
    
    public required init(copy: VehicleAd) {
        self.id = copy.id
        self.url = copy.url
        self.price = copy.price
        self.date = copy.date
        self.mileage = copy.mileage
        self.region = copy.region
        self.city = copy.city
        self.adDescription = copy.adDescription
        
        let photos = List<String>()
        photos.append(objectsIn: copy.photos)
        self.photos = photos
    }
    
    required init() {
        super.init()
    }
}
