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;

/**
 * Signature entity for storing signature SVG data from task completions.
 * References the task ObjectId and stores SVG signature strings.
 */
@Data
@Document(collection = "signatures")
public class Signature {

    @Id
    private ObjectId id;

    private ObjectId taskId;
    private String signatureSvg;
    private String note;
    private LocalDateTime createdAt;
    private String completedBy;

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

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

    public Signature(ObjectId taskId, String signatureSvg, String note, String completedBy) {
        this(taskId, signatureSvg, completedBy);
        this.note = note;
    }
}