import Foundation
import SwiftData

@Model
final class WeekPlan {
    @Attribute(.unique) var id: UUID
    var weekStartDate: Date
    var createdAt: Date
    var updatedAt: Date

    @Relationship(deleteRule: .cascade)
    var slots: [MealSlot]

    init(
        id: UUID = UUID(),
        weekStartDate: Date,
        slots: [MealSlot] = [],
        createdAt: Date = Date(),
        updatedAt: Date = Date()
    ) {
        self.id = id
        self.weekStartDate = weekStartDate
        self.slots = slots
        self.createdAt = createdAt
        self.updatedAt = updatedAt
    }
}
