import json


def parameters(tmp_path):
    """Create a dummy parameter file."""
    parameter = {
        "input_ds": {
            "clustering": {
                "neighbors": 10,
                "res": 0.15
            },
            "filtering": {
                "min_cells": 3,
                "min_genes": 10
            },
            "n_cpus_preprocessing": 6,
            "raw_input": None,
            "scale": {
                "LSN": 20000,
                "fixed_scaling": {
                    "mean": "genes",
                    "var": "genes"
                }
            },
            "split": {
                "balanced_split": True,
                "split_seed": 0,
                "test_cells": 0,
                "valid_cells": 100
            }
        },
        "model": {
            "activation_fn": "tensorflow.keras.activations.relu",
            "encoder": {
                "layers": [128, 64, 32],
                "norm_type": [
                    "conditionallayernorm", "conditionallayernorm",
                    "conditionallayernorm"
                ],
                "regularization":
                0.15
            },
            "decoder": {
                "layers": [32, 64, 128],
                "norm_type": [
                    "conditionallayernorm", "conditionallayernorm",
                    "conditionallayernorm"
                ],
                "regularization":
                0.18
            },
            "latent_dim": 16,
            "output_fn": None,
            "reconstruction_loss": {
                "name": "HuberLoss",
                "delta": 11.0,
            },
            "wae_lambda": 11.32395861201524,
            "weighting_random_encoder": 4.407237266397266e-05
        },
        "training": {
            "GPU": [0],
            "XLA": True,
            "batch_size": 128,
            "early_stopping": {
                "patience": 20,
                "min_delta": 0.01,
                'mode': 'auto',
                'monitor': 'val_loss',
                'restore_best_weights': True
            },
            "max_steps": 100,
            "optimizer": {
                "algorithm": "tensorflow_addons.optimizers.RectifiedAdam",
                "amsgrad": False,
                "beta_1": 0.85,
                "beta_2": 0.95,
                "learning_rate": 0.0009136083007127199
            },
            "parallel_pc": 5
        }
    }
    parameters_file = tmp_path.joinpath('parameters.json')
    with parameters_file.open('w') as file:
        json.dump(parameter, file)
    return parameters_file