import pathlib


def generate_face_image_path(src_image_path, face_image_dir, face_id):
    """ Generate a file path of an extracted face image

    Arguments
    ---------
    src_image_path: str
        a directory path which source images have been saved at.
    face_image_dir: str
        a directory path where extracted face images will be saved.
    face_id: int
        an ID of an extracted image.

    Returns
    -------
        pathlib.Path object.
        a path which is used at saving an extracted image.
    """
    src_image_id = src_image_path.stem
    suffix = src_image_path.suffix
    face_image_id = src_image_id + '{:02d}'.format(face_id)
    face_image_filename = face_image_id + suffix
    _face_image_dir = pathlib.Path(face_image_dir)
    member_id = str(src_image_path.parent).split('/')[-1]
    face_image_path = _face_image_dir.joinpath(member_id, face_image_filename)
    return pathlib.Path(face_image_path)