import flwr as fl
from typing import Dict
# Start Flower server for three rounds of federated learning

def fit_round(rnd: int) -> Dict:
    """Send round number to client."""
    return {"rnd": rnd}

if __name__ == "__main__":
    strategy = fl.server.strategy.FedAvg(
        # fraction_fit=0.1,  # Sample 10% of available clients for the next round
        # min_fit_clients=2,  # Minimum number of clients to be sampled for the next round
        min_available_clients=2,
        on_fit_config_fn=fit_round,
        # Minimum number of clients that need to be connected to the server before a training round can start
    )
    fl.server.start_server("localhost:5000", config={"num_rounds": 3},force_final_distributed_eval = True,strategy=strategy)