//
//  OCProject.swift
//  OnCue
//
//  Created by Pradyun Setti on 22/06/2024.
//

import Foundation
import SwiftData

@Model
final class OCProject {
    var name: String
    var cards: [OCCard]
    let creationDate: Date
    var lastEditedDate: Date
    
    init(name: String, cards: [OCCard] = []) {
        self.name = name
        self.cards = cards
        self.creationDate = Date()
        self.lastEditedDate = Date()
    }
    
    func updateEditedDate(newDate: Date = Date()) {
        self.lastEditedDate = newDate
    }
    
    func addCards(cards: OCCard...) {
        cards.forEach({ self.cards.append($0) })
    }
}
