package com.social.media.application.campaign.dto;

import lombok.Builder;
import lombok.Value;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * Automation Campaign DTO
 */
@Value
@Builder
public class AutomationCampaignDto {
    Long id;
    String campaignCode;
    Long companyId;
    Long socialAccountId;
    
    // Campaign information
    String name;
    String description;
    String campaignType;
    String status;
    
    // Configuration
    TargetConfigurationDto targetConfig;
    ActionConfigurationDto actionConfig;
    ScheduleConfigurationDto scheduleConfig;
    
    // Execution tracking
    Integer totalPlannedActions;
    Integer totalExecutedActions;
    Integer successfulActions;
    Integer failedActions;
    
    // Dates
    LocalDateTime plannedStartDate;
    LocalDateTime plannedEndDate;
    LocalDateTime actualStartDate;
    LocalDateTime actualEndDate;
    LocalDateTime lastExecutionDate;
    
    // Flags
    Boolean isActive;
    Boolean autoRestart;
    
    // Calculated metrics
    Double successRate;
    
    // Audit
    LocalDateTime createdAt;
    LocalDateTime updatedAt;
    
    @Value
    @Builder
    public static class TargetConfigurationDto {
        List<String> targetUsers;
        List<String> targetHashtags;
        List<String> targetLocations;
        List<String> excludeUsers;
        FilterCriteriaDto filterCriteria;
        
        @Value
        @Builder
        public static class FilterCriteriaDto {
            Integer minFollowers;
            Integer maxFollowers;
            Integer accountAge;
            Double engagementRate;
        }
    }
    
    @Value
    @Builder
    public static class ActionConfigurationDto {
        List<String> actions;
        String actionSequence;
        Integer actionsPerUser;
        List<String> commentTemplates;
        List<String> dmTemplates;
        List<String> customMessages;
    }
    
    @Value
    @Builder
    public static class ScheduleConfigurationDto {
        String startDate;
        String endDate;
        Integer dailyLimit;
        Integer hourlyLimit;
        Integer actionsPerHour;
        Integer delayBetweenActions;
        WorkingHoursDto workingHours;
        RandomizationDto randomization;
        
        @Value
        @Builder
        public static class WorkingHoursDto {
            Boolean enabled;
            String start;
            String end;
            List<Integer> workDays;
        }
        
        @Value
        @Builder
        public static class RandomizationDto {
            Boolean enabled;
            Integer minDelay;
            Integer maxDelay;
        }
    }
}
