package de.assecutor.votianlt.model;

import de.assecutor.votianlt.model.task.BaseTask;
import lombok.Data;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.index.Indexed;

import java.time.LocalDateTime;
import java.util.List;

@Data
@Document(collection = "task_templates")
public class TaskTemplate {

    @Id
    private ObjectId id;

    @Indexed
    private ObjectId userId;

    private String templateName;
    private List<BaseTask> tasks;

    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;

    public TaskTemplate() {
        this.createdAt = LocalDateTime.now();
        this.updatedAt = LocalDateTime.now();
    }

    public void updateTimestamp() {
        this.updatedAt = LocalDateTime.now();
    }
}