import json


def validateInputParametersFile(filename):
    """
    Validates an input (json) file to check if
    it contains the required keys. It does not
    validate the values of the keys.

    :param filename: Is a "Path" object that
    contains the input model parameters for
    the simulation.

    :return: A dictionary loaded from the input
    file.

    :raises ValueError: if a keyword is missing
    from the file.
    """

    # Import locally the json package.

    # Open the file in "Read Only" mode.
    with open(filename, 'r') as input_file:

        # Load the model parameters.
        model_params = json.load(input_file)

        # Required keys in the json file.
        required_keys = ("Trees", "Well_No", "Output_Name", "IC_Filename",
                         "Data_Filename", "Water_Content", "Environmental",
                         "Soil_Properties", "Site_Information", "Simulation_Flags",
                         "Hydrological_Model", "Hydraulic_Conductivity")

        # Check the keywords for membership in the file.
        for k in required_keys:

            # The order in here doesn't matter.
            if k not in model_params:
                raise ValueError(f" Key: {k}, is not given.")
            # _end_if_

        # _end_for_

        # Show message.
        print(" Model parameters are given correctly.")
    # _end_with_

    # The dictionary will contain all the input parameters.
    return model_params