package de.assecutor.votianlt.messaging.delivery;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.time.Duration;

/**
 * Configuration for message delivery service.
 */
@Configuration
@ConfigurationProperties(prefix = "app.messaging.delivery")
@Data
public class DeliveryConfig {

    /**
     * Maximum number of retry attempts for failed deliveries
     */
    private int maxRetries = 3;

    /**
     * Initial delay before first retry
     */
    private Duration retryInitialDelay = Duration.ofSeconds(5);

    /**
     * Maximum delay between retries
     */
    private Duration retryMaxDelay = Duration.ofMinutes(5);

    /**
     * Backoff multiplier for exponential backoff
     */
    private double retryBackoffMultiplier = 2.0;

    /**
     * Timeout for waiting for acknowledgment
     */
    private Duration ackTimeout = Duration.ofSeconds(30);

    /**
     * Default message expiry duration
     */
    private Duration messageExpiry = Duration.ofHours(24);

    /**
     * Interval for cleanup task (in minutes)
     */
    private int cleanupIntervalMinutes = 60;

    /**
     * Interval for retry task (in seconds)
     */
    private int retryIntervalSeconds = 30;

    /**
     * Retention period for acknowledged deliveries (in days)
     */
    private int acknowledgedRetentionDays = 7;
}

