from typing import Dict
from typing import List


def update_samplesheet(samplesheet_dict: Dict, sample_id: str, lanes: List) -> Dict:
    """
    Update the dataframe in the samplesheet to be just a single sample
    :param samplesheet_dict:
    :param sample_id:
    :param lanes:
    :return:
    """
    # Get the data section
    sample_df = samplesheet_dict["Data"]

    # Add in the lane information
    sample_df["Lane"] = lanes
    # Rename the columns
    sample_df.rename(columns={"Index": "index", "Index2": "index2"}, inplace=True)
    # Add in the Sample_Name column
    sample_df["Sample_Name"] = sample_id
    # Drop the Sample_Type column
    sample_df.drop(columns="Sample_Type", inplace=True)

    # Reorder
    sample_df = sample_df[["Sample_ID", "Sample_Name", "Lane", "index", "index2"]]

    # Set to just the first row
    sample_df = sample_df.head(n=1)

    # Reassign
    samplesheet_dict["Data"] = sample_df

    # Return
    return samplesheet_dict