//
//  Purchase.swift
//  LeStorage
//
//  Created by Laurent Morvillier on 12/04/2024.
//

import Foundation
import LeStorage

class Purchase: ModelObject, Storable {
   
    static func resourceName() -> String { return "purchases" }
    static func tokenExemptedMethods() -> [HTTPMethod] { return [] }

    var id: String = Store.randomId()
    
    var user: String
    var identifier: UInt64
    var purchaseDate: Date
    var productId: String
    var quantity: Int?
    var revocationDate: Date? = nil
    
    init(user: String, identifier: UInt64, purchaseDate: Date, productId: String, quantity: Int? = nil, revocationDate: Date? = nil) {
        self.user = user
        self.identifier = identifier
        self.purchaseDate = purchaseDate
        self.productId = productId
        self.quantity = quantity
    }
    
}
