from .utils import uuid


def slideshow(obj, formatslide_body, classname, items=1):
    return {
        "type": "Slideshow",
        "value": {
            "slides": [
                {
                    "type": "item",
                    "value": {
                        "image": slide["image"],
                        "body": formatslide_body(slide),
                        "position": "middle-left",
                    },
                    "id": uuid(),
                }
                for slide in obj["value"]
            ],
            "items": items,
            "slideby": "1",
            "controls": True,
            "autoplaytimeout": "",
            "loop": True,
            "nav": False,
            "autoheight": True,
            "autoplay": False,
            "fixed_height": "",
            "lazy": False,
            "styling": {
                "margin": "",
                "padding": "",
                "border": "",
                "border_radius": "",
                "background_color": "",
                "color": "",
                "font_size": None,
                "text_align": "",
                "block_classes": classname,
            },
        },
        "id": uuid(),
    }
