from oscar.defaults import OSCAR_REQUIRED_ADDRESS_FIELDS

from ocyan.core.fender import config

OCYAN_REST_FRAMEWORK_SETTINGS = {
    "REST_FRAMEWORK": {
        "DEFAULT_RENDERER_CLASSES": [
            "rest_framework.renderers.JSONRenderer",
            "rest_framework.renderers.BrowsableAPIRenderer",
        ],
        "DEFAULT_VERSIONING_CLASS": "rest_framework.versioning.NamespaceVersioning",
        "DEFAULT_PARSER_CLASSES": ["rest_framework.parsers.JSONParser"],
        "DEFAULT_AUTHENTICATION_CLASSES": [
            "rest_framework.authentication.SessionAuthentication"
        ],
    },
    "OSCARAPI_OVERRIDE_MODULES": [
        "ocyan.plugin.oscar_checkout.checkoutapi.api_extension"
    ],
    "OSCARAPI_ROOT_URLS": ["checkoutapi:api-root"],
}

# pylint: disable=no-member
OCYAN_CHECKOUT_OSCAR_SETTINGS = {
    "OSCAR_REQUIRED_ADDRESS_FIELDS": OSCAR_REQUIRED_ADDRESS_FIELDS
    + (
        "house_number",
        "email",
    ),
    "OSCARAPI_USERADDRESS_FIELDS": [
        "id",
        "email",
        "title",
        "first_name",
        "last_name",
        "line1",
        "line2",
        "line3",
        "line4",
        "state",
        "postcode",
        "search_text",
        "phone_number",
        "notes",
        "is_default_for_shipping",
        "is_default_for_billing",
        "country",
        "url",
        "house_number",
    ],
    "OSCAR_SHIPPING_FORM_FIELD_ORDER": [
        "title",
        "first_name",
        "last_name",
        "line1",
        "house_number",
        "line2",
        "line3",
        "line4",
        "state",
        "postcode",
        "country",
        "phone_number",
        "notes",
    ],
    "OSCAR_SHIPPING_FORM_FIELDS": [
        "title",
        "first_name",
        "last_name",
        "line1",
        "house_number",
        "line2",
        "line3",
        "line4",
        "state",
        "postcode",
        "country",
        "phone_number",
        "notes",
    ],
    "OSCAR_BILLING_FORM_FIELDS": [
        "email",
        "title",
        "first_name",
        "last_name",
        "line1",
        "house_number",
        "line2",
        "line3",
        "line4",
        "state",
        "postcode",
        "country",
    ],
    "OSCAR_BILLING_FORM_FIELD_ORDER": [
        "email",
        "title",
        "first_name",
        "last_name",
        "line1",
        "house_number",
        "line2",
        "line3",
        "line4",
        "state",
        "postcode",
        "country",
    ],
    "OSCAR_HIDDEN_FEATURES": (
        ["newsletter"] if "ocyan.plugin.newsletter" not in config.ocyan_plugins else []
    ),
}
