package de.assecutor.votianlt.model;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.bson.types.ObjectId;

import java.time.LocalDateTime;

/**
 * Barcode entity for storing barcode data from task completions. References the
 * task ObjectId and stores barcode strings.
 */
@Data
@Document(collection = "barcodes")
public class Barcode {

    @Id
    private ObjectId id;

    private ObjectId taskId;
    private String barcode;
    private LocalDateTime createdAt;
    private String completedBy;

    // Default constructor
    public Barcode() {
        this.createdAt = LocalDateTime.now();
    }

    // Constructor with parameters
    public Barcode(ObjectId taskId, String barcode, String completedBy) {
        this();
        this.taskId = taskId;
        this.barcode = barcode;
        this.completedBy = completedBy;
    }
}