from pathlib import Path
import shutil


def rename_trimming_results(path: Path):
    """
    Rename Skewer output to a simple name used in Virtool.

    :param path: The path containing the results from Skewer
    """
    shutil.move(
        path / "reads-trimmed.log",
        path / "trim.log",
    )

    try:
        return (
            shutil.move(
                path / "reads-trimmed.fastq.gz",
                path / "reads_1.fq.gz",
            ),
        )
    except FileNotFoundError:
        return (
            shutil.move(
                path / "reads-trimmed-pair1.fastq.gz",
                path / "reads_1.fq.gz",
            ),
            shutil.move(
                path / "reads-trimmed-pair2.fastq.gz",
                path / "reads_2.fq.gz",
            ),
        )