package de.assecutor.votianlt.model;

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;

@Data
@Document(collection = "user_invoice_data")
public class UserInvoiceData {

    @Id
    private ObjectId id;

    @Indexed
    private ObjectId userId;

    private boolean billingEnabled;
    private String prefix;
    private String ustId;
    private String taxNumber;
    private String bankName;
    private String iban;
    private String taxRate;
    private String introText;
    private String paymentTerms;

    private long nextInvoiceNumber = 0;

    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;

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

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