package com.social.media.service;

import com.social.media.dto.SocialNetworkDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Optional;

/**
 * Service interface for managing social networks
 */
public interface SocialNetworkService {
    
    /**
     * Create a new social network
     */
    SocialNetworkDto create(SocialNetworkDto dto);
    
    /**
     * Update an existing social network
     */
    SocialNetworkDto update(Long id, SocialNetworkDto dto);
    
    /**
     * Find social network by ID
     */
    Optional<SocialNetworkDto> findById(Long id);
    
    /**
     * Find social network by network code
     */
    Optional<SocialNetworkDto> findByNetworkCode(String networkCode);
    
    /**
     * Get all social networks with pagination
     */
    Page<SocialNetworkDto> findAll(Pageable pageable);
    
    /**
     * Get all active social networks
     */
    List<SocialNetworkDto> findAllActive();
    
    /**
     * Get active social networks with pagination
     */
    Page<SocialNetworkDto> findAllActive(Pageable pageable);
    
    /**
     * Get social networks by platform
     */
    List<SocialNetworkDto> findByPlatform(String platform);
    
    /**
     * Get active social networks by platform
     */
    List<SocialNetworkDto> findActiveByPlatform(String platform);
    
    /**
     * Get social networks that support a specific feature
     */
    List<SocialNetworkDto> findNetworksWithFeature(String feature);
    
    /**
     * Get active social networks that support a specific feature
     */
    List<SocialNetworkDto> findActiveNetworksWithFeature(String feature);
    
    /**
     * Get social networks that require approval
     */
    List<SocialNetworkDto> findNetworksRequiringApproval();
    
    /**
     * Get social networks ready for production
     */
    List<SocialNetworkDto> findProductionReadyNetworks();
    
    /**
     * Get social networks by brand color
     */
    List<SocialNetworkDto> findByBrandColor(String color);
    
    /**
     * Search social networks by name
     */
    List<SocialNetworkDto> searchByName(String name);
    
    /**
     * Activate a social network
     */
    void activate(Long id);
    
    /**
     * Deactivate a social network
     */
    void deactivate(Long id);
    
    /**
     * Enable approval requirement for a network
     */
    void enableApproval(Long id);
    
    /**
     * Disable approval requirement for a network
     */
    void disableApproval(Long id);
    
    /**
     * Update sort order for a network
     */
    void updateSortOrder(Long id, Integer sortOrder);
    
    /**
     * Update API configuration for a network
     */
    void updateApiConfig(Long id, String apiConfig);
    
    /**
     * Update rate limits for a network
     */
    void updateRateLimits(Long id, String rateLimits);
    
    /**
     * Update supported features for a network
     */
    void updateSupportedFeatures(Long id, String supportedFeatures);
    
    /**
     * Delete a social network (soft delete by deactivating)
     */
    void delete(Long id);
    
    /**
     * Get the total count of social networks
     */
    Long getTotalCount();
    
    /**
     * Get the count of active social networks
     */
    Long getActiveCount();
    
    /**
     * Get the count of networks requiring approval
     */
    Long getApprovalRequiredCount();
    
    /**
     * Get the count of production-ready networks
     */
    Long getProductionReadyCount();
    
    /**
     * Check if a network code exists
     */
    boolean existsByNetworkCode(String networkCode);
    
    /**
     * Check if a network exists and is active
     */
    boolean isNetworkActive(String networkCode);
    
    /**
     * Check if a network supports a specific feature
     */
    boolean supportsFeature(String networkCode, String feature);
    
    /**
     * Get rate limit for a specific network and limit type
     */
    Integer getRateLimit(String networkCode, String limitType);
    
    /**
     * Validate API configuration for a network
     */
    boolean validateApiConfig(String networkCode);
    
    /**
     * Test connection to a social network
     */
    boolean testConnection(String networkCode);
}
