# -*- coding: utf-8 -*-
from ocyan.core.plugins import OcyanPluginConfig
from ocyan.core.utils import merge_dicts

SEO_FILE_BACKEND_SETTINGS = {
    "THUMBNAIL_BACKEND": "seo.ville.sorl.SEOThumbnailBackend",
    "THUMBNAIL_STORAGE": "seo.ville.sorl.SEOThumbnailStorage",
    "SEO_VILLE_SLUGGER_ALLOW_COPIES": True,
}


class SeoPluginConfig(OcyanPluginConfig):
    def contribute_to_settings(self, settings):
        if "STORAGES" not in settings:
            settings["STORAGES"] = {
                "default": {"BACKEND": "seo.ville.slugger.SEOStorage"}
            }
        else:
            settings["STORAGES"]["default"] = {
                "BACKEND": "seo.ville.slugger.SEOStorage"
            }
        return merge_dicts(settings, SEO_FILE_BACKEND_SETTINGS, overwrite=True)
