from datetime import datetime, timezone
from django.http import JsonResponse
from rest_framework import serializers
from common.common import getLanguage, validateParentId
from payment.methods import create_payment_intent
from .models import *
from mama_care_api.settings import *
from django.db.models import F

isDetailKey = "isDetail"
isDetailValue = "1"


def getIsDetail(self):
    if self.context.__contains__("request"):
        isDetail = self.context["request"].query_params.get("isDetail", None)
    elif self.context.__contains__("isDetail"):
        isDetail = self.context["isDetail"]
    else:
        isDetail = None
    return isDetail


# Currency
def getCurrencyRecord(currencyId):
    if currencyId is not None:
        selectedCurrency = Currency.objects.get(id=currencyId)
        if selectedCurrency.isEnabled:
            return selectedCurrency.id
    return None


def getCurrency(self):
    if self.context.__contains__("request"):
        currencyId = self.context["request"].headers.get(currencyKey, None)
    elif self.context.__contains__(currencyKey):
        currencyId = self.context[currencyKey]
    else:
        currencyId = None

    return getCurrencyRecord(currencyId)


# Currency
class CurrencySerializer(serializers.ModelSerializer):
    name = serializers.SerializerMethodField()

    class Meta:
        model = Currency
        fields = [
            "id",
            "symbol",
            "code",
            "isEnabled",
            "createdDate",
            "updatedDate",
            "name",
        ]

    def get_name(self, instance):
        languageId = getLanguage(self)
        if languageId is not None:
            currencyLanguageList = CurrencyLanguage.objects.filter(
                currencyId=str(instance.id)
            ).filter(languageId=languageId)
            if currencyLanguageList.__len__() > 0:
                return currencyLanguageList[0].name


class CurrencyLanguageSerializer(serializers.ModelSerializer):
    class Meta:
        model = CurrencyLanguage
        fields = [
            "id",
            "name",
            "createdDate",
            "updatedDate",
            "languageId",
            "currencyId",
        ]


# Payment Method
class PaymentMethodSerializer(serializers.ModelSerializer):
    name = serializers.SerializerMethodField()

    class Meta:
        model = PaymentMethod
        fields = ["id", "keyName", "createdDate", "updatedDate", "name"]

    def get_name(self, instance):
        languageId = getLanguage(self)
        if languageId is not None:
            paymentMethodLanguageList = PaymentMethodLanguage.objects.filter(
                paymentMethodId=str(instance.id)
            ).filter(languageId=languageId)
            if paymentMethodLanguageList.__len__() > 0:
                return paymentMethodLanguageList[0].name


class PaymentMethodLanguageSerializer(serializers.ModelSerializer):
    class Meta:
        model = PaymentMethodLanguage
        fields = [
            "id",
            "name",
            "createdDate",
            "updatedDate",
            "languageId",
            "paymentMethodId",
        ]


# Store
class StoreSerializer(serializers.ModelSerializer):
    name = serializers.SerializerMethodField()
    currency = serializers.SerializerMethodField()

    class Meta:
        model = Store
        fields = [
            "id",
            "keyName",
            "createdDate",
            "updatedDate",
            "currencyId",
            "name",
            "currency",
        ]

    def get_name(self, instance):
        languageId = getLanguage(self)
        if languageId is not None:
            storeLanguageList = StoreLanguage.objects.filter(
                storeId=str(instance.id)
            ).filter(languageId=languageId)
            if storeLanguageList.__len__() > 0:
                return storeLanguageList[0].name

    def get_currency(self, instance):
        selected = Currency.objects.get(id=instance.currencyId.id)
        return CurrencySerializer(selected).data


class StoreLanguageSerializer(serializers.ModelSerializer):
    class Meta:
        model = StoreLanguage
        fields = ["id", "name", "createdDate", "updatedDate", "languageId", "storeId"]


# Shopping Account
class ShoppingAccountSerializer(serializers.ModelSerializer):
    store = serializers.SerializerMethodField()

    class Meta:
        model = ShoppingAccount
        fields = [
            "id",
            "isSelected",
            "createdDate",
            "updatedDate",
            "parentId",
            "storeId",
            "store",
        ]

    def get_store(self, instance):
        languageId = getLanguage(self)
        return StoreSerializer(instance.storeId, context={languageKey: languageId}).data


class AddressBookSerializer(serializers.ModelSerializer):
    isAuthorized = serializers.SerializerMethodField()

    class Meta:
        model = AddressBook
        fields = [
            "id",
            "phone",
            "country",
            "city",
            "address",
            "postCode",
            "isSelected",
            "shoppingAccountId",
            "isAuthorized",
        ]

    def get_isAuthorized(self, instance):
        return validateParentId(self, instance.shoppingAccountId.parentId.id)

    def validate(self, data):
        errorMessage = ""
        isCheck = False
        if "shoppingAccountId" in data:
            isCheck = validateParentId(self, data["shoppingAccountId"].parentId.id)
        else:
            errorMessage = "Parent Id does not exit"

        if isCheck == True:
            return data

        elif len(errorMessage) > 0:
            raise serializers.ValidationError({"error": [errorMessage]})


# Collection
class CollectionSerializer(serializers.ModelSerializer):
    name = serializers.SerializerMethodField()

    class Meta:
        model = Collection
        fields = ["id", "keyName", "createdDate", "updatedDate", "name", "collectionId"]

    def get_name(self, instance):
        languageId = getLanguage(self)
        if languageId is not None:
            collectionLanguageList = CollectionLanguage.objects.filter(
                collectionId=str(instance.id)
            ).filter(languageId=languageId)
            if collectionLanguageList.__len__() > 0:
                return collectionLanguageList[0].name


class CollectionLanguageSerializer(serializers.ModelSerializer):
    class Meta:
        model = CollectionLanguage
        fields = [
            "id",
            "name",
            "createdDate",
            "updatedDate",
            "languageId",
            "collectionId",
        ]


class StoreCollectionSerializer(serializers.ModelSerializer):
    collection = serializers.SerializerMethodField()

    class Meta:
        model = StoreCollection
        fields = ["id", "collectionId", "storeId", "collection"]

    def get_collection(self, instance):
        languageId = getLanguage(self)
        selected = Collection.objects.get(id=instance.collectionId.id)
        return CollectionSerializer(selected, context={"languageId": languageId}).data


class SellerShippingCostSerializer(serializers.ModelSerializer):
    shippingCostList = serializers.SerializerMethodField()

    class Meta:
        model = SellerShippingCost
        fields = ["id", "keyName", "createdDate", "updatedDate", "shippingCostList"]

    def get_shippingCostList(self, instance):
        dataList = ShippingCost.objects.filter(sellerShippingCostId=instance.id)
        return ShippingCostSerializer(dataList, many=True).data


# Product
class ProductBasicSerializer(serializers.ModelSerializer):
    name = serializers.SerializerMethodField()

    class Meta:
        model = Product
        fields = ["id", "name"]

    def get_name(self, instance):
        languageId = getLanguage(self)
        if languageId is not None:
            productLanguageList = ProductLanguage.objects.filter(
                productId=str(instance.id)
            ).filter(languageId=languageId)
            if productLanguageList.__len__() > 0:
                return productLanguageList[0].name


class ProductSerializer(serializers.ModelSerializer):
    name = serializers.SerializerMethodField()
    description = serializers.SerializerMethodField()
    optionList = serializers.SerializerMethodField()
    optionValueList = serializers.SerializerMethodField()
    skuList = serializers.SerializerMethodField()
    skuOptionValueList = serializers.SerializerMethodField()

    class Meta:
        model = Product
        fields = [
            "id",
            "keyName",
            "isDigital",
            "isFree",
            "isVisible",
            "createdDate",
            "updatedDate",
            "name",
            "description",
            "optionList",
            "optionValueList",
            "skuList",
            "skuOptionValueList",
        ]

    def getIsDetail(self):
        request = self.context.get("request")
        view = self.context.get("view")
        is_read = request and request.method == "GET"
        product_id = view.kwargs.get("id") if view else None
        if is_read and product_id:
            return True
        return False

    def get_name(self, instance):
        languageId = getLanguage(self)
        if languageId is not None:
            productLanguageList = ProductLanguage.objects.filter(
                productId=str(instance.id)
            ).filter(languageId=languageId)
            if productLanguageList.__len__() > 0:
                return productLanguageList[0].name

    def get_description(self, instance):
        languageId = getLanguage(self)
        if languageId is not None:
            productLanguageList = ProductLanguage.objects.filter(
                productId=str(instance.id)
            ).filter(languageId=languageId)
            if productLanguageList.__len__() > 0:
                return productLanguageList[0].description

    def get_optionList(self, instance):
        if self.getIsDetail():
            languageId = getLanguage(self)
            dataList = ProductOption.objects.filter(productId=instance.id)
            return ProductOptionSerializer(
                dataList, context={languageKey: languageId}, many=True
            ).data
        return []

    def get_optionValueList(self, instance):
        if self.getIsDetail():
            languageId = getLanguage(self)
            dataList = ProductOptionValue.objects.filter(
                productOptionId__productId=instance.id
            )
            return ProductOptionValueSerializer(
                dataList, context={languageKey: languageId}, many=True
            ).data
        return []

    def get_skuList(self, instance):
        currencyId = getCurrency(self)
        if self.getIsDetail() == False:
            dataList = (
                SKU.objects.filter(
                    productId=instance.id, sku_skuprice__currencyId=currencyId
                )
                .order_by("sku_skuprice__salePrice")
                .first()
            )

            return [
                SKUSerializer(
                    dataList, context={currencyKey: currencyId}, many=False
                ).data
            ]
        else:
            dataList = SKU.objects.filter(
                productId=instance.id, sku_skuprice__currencyId=currencyId
            ).order_by("sku_skuprice__salePrice")

            return SKUSerializer(
                dataList, context={currencyKey: currencyId}, many=True
            ).data

    def get_skuOptionValueList(self, instance):
        if self.getIsDetail():
            datalist = SKUOptionValue.objects.filter(skuId__productId=instance.id)
            return SKUOptionValueSerializer(datalist, many=True).data
        return []


class ProductLanguageSerializer(serializers.ModelSerializer):
    class Meta:
        model = ProductLanguage
        fields = [
            "id",
            "name",
            "description",
            "createdDate",
            "updatedDate",
            "languageId",
            "productId",
        ]


class ProductCollectionSerializer(serializers.ModelSerializer):
    collection = serializers.SerializerMethodField()
    product = serializers.SerializerMethodField()

    class Meta:
        model = ProductCollection
        fields = [
            "id",
            "createdDate",
            "updatedDate",
            "productId",
            "collectionId",
            "collection",
            "product",
        ]

    def get_collection(self, instance):
        languageId = getLanguage(self)
        selected = Collection.objects.get(id=instance.collectionId.id)
        return CollectionSerializer(selected, context={languageKey: languageId}).data

    def get_product(self, instance):
        languageId = getLanguage(self)
        currencyId = getCurrency(self)
        selected = Product.objects.get(id=instance.productId.id)
        return ProductSerializer(
            selected, context={languageKey: languageId, currencyKey: currencyId}
        ).data


# Product Option
class ProductOptionSerializer(serializers.ModelSerializer):
    name = serializers.SerializerMethodField()

    class Meta:
        model = ProductOption
        fields = ["id", "keyName", "createdDate", "updatedDate", "productId", "name"]

    def get_name(self, instance):
        languageId = getLanguage(self)
        if languageId is not None:
            productOptionLanguageList = ProductOptionLanguage.objects.filter(
                productOptionId=str(instance.id)
            ).filter(languageId=languageId)
            if productOptionLanguageList.__len__() > 0:
                return productOptionLanguageList[0].name


class ProductOptionLanguageSerializer(serializers.ModelSerializer):
    class Meta:
        model = ProductOptionLanguage
        fields = [
            "id",
            "name",
            "createdDate",
            "updatedDate",
            "languageId",
            "productOptionId",
        ]


# Product Option Value
class ProductOptionValueSerializer(serializers.ModelSerializer):
    name = serializers.SerializerMethodField()
    productOption = serializers.SerializerMethodField()

    class Meta:
        model = ProductOptionValue
        fields = [
            "id",
            "keyName",
            "value",
            "createdDate",
            "updatedDate",
            "productOptionId",
            "name",
            "productOption",
        ]

    def get_name(self, instance):
        languageId = getLanguage(self)
        if languageId is not None:
            productOptionValueLanguageList = ProductOptionValueLanguage.objects.filter(
                productOptionValueId=str(instance.id)
            ).filter(languageId=languageId)
            if productOptionValueLanguageList.__len__() > 0:
                return productOptionValueLanguageList[0].name

    def get_productOption(self, instance):
        isDetail = getIsDetail(self)
        if isDetail == isDetailValue:
            languageId = getLanguage(self)
            dataList = ProductOption.objects.filter(id=instance.productOptionId.id)
            if dataList.__len__() > 0:
                return ProductOptionSerializer(
                    dataList[0],
                    context={languageKey: languageId, isDetailKey: isDetailValue},
                ).data


class ProductOptionValueLanguageSerializer(serializers.ModelSerializer):
    class Meta:
        model = ProductOptionValueLanguage
        fields = [
            "id",
            "name",
            "createdDate",
            "updatedDate",
            "languageId",
            "productOptionValueId",
        ]


# SKU
class SKUSerializer(serializers.ModelSerializer):
    priceList = serializers.SerializerMethodField()
    imageList = serializers.SerializerMethodField()

    class Meta:
        model = SKU
        fields = [
            "id",
            "serial",
            "stock",
            "createdDate",
            "updatedDate",
            "productId",
            "priceList",
            "imageList",
        ]

    def get_priceList(self, instance):
        currencyId = getCurrency(self)
        dataList = SKUPrice.objects.filter(skuId=instance.id).filter(
            currencyId=currencyId
        )
        return SKUPriceSerializer(dataList, many=True).data

    def get_imageList(self, instance):
        imageList = SKUImage.objects.filter(skuId=instance.id)
        return SKUImageSerializer(imageList, many=True).data


class ShippingCostSerializer(serializers.ModelSerializer):
    class Meta:
        model = ShippingCost
        fields = [
            "id",
            "isFreeShipping",
            "minDeliveryDays",
            "maxDeliveryDays",
            "cost",
            "defaultCost",
            "createdDate",
            "updatedDate",
            "skuPriceId",
            "sellerShippingCostId",
        ]


class SKUOptionValueSerializer(serializers.ModelSerializer):
    productOptionValue = serializers.SerializerMethodField()

    class Meta:
        model = SKUOptionValue
        fields = [
            "id",
            "createdDate",
            "updatedDate",
            "productOptionValueId",
            "skuId",
            "productOptionValue",
        ]

    def get_productOptionValue(self, instance):
        isDetail = getIsDetail(self)
        if isDetail == isDetailValue:
            languageId = getLanguage(self)
            dataList = ProductOptionValue.objects.filter(
                id=instance.productOptionValueId.id
            )
            if dataList.__len__() > 0:
                return ProductOptionValueSerializer(
                    dataList[0],
                    context={languageKey: languageId, isDetailKey: isDetailValue},
                ).data


class SKUImageSerializer(serializers.ModelSerializer):
    class Meta:
        model = SKUImage
        fields = ["id", "imageUrl", "createdDate", "updatedDate", "skuId"]


class SKUPriceSerializer(serializers.ModelSerializer):
    shippingCost = serializers.SerializerMethodField()

    class Meta:
        model = SKUPrice
        fields = [
            "id",
            "salePrice",
            "originalPrice",
            "createdDate",
            "updatedDate",
            "currencyId",
            "skuId",
            "shippingCost",
        ]

    def get_shippingCost(self, instance):
        shippingCostList = ShippingCost.objects.filter(skuPriceId=instance.id)
        if shippingCostList.__len__() > 0:
            if shippingCostList[0].isFreeShipping:
                return shippingCostList[0].defaultCost
            return shippingCostList[0].cost


# SKU Detail
class SKUDetailSerializer(serializers.ModelSerializer):
    priceList = serializers.SerializerMethodField()
    imageList = serializers.SerializerMethodField()
    optionValueList = serializers.SerializerMethodField()
    product = serializers.SerializerMethodField()

    class Meta:
        model = SKU
        fields = [
            "id",
            "serial",
            "stock",
            "createdDate",
            "updatedDate",
            "productId",
            "priceList",
            "imageList",
            "optionValueList",
            "product",
        ]

    def get_priceList(self, instance):
        currencyId = getCurrency(self)
        dataList = SKUPrice.objects.filter(skuId=instance.id).filter(
            currencyId=currencyId
        )
        return SKUPriceSerializer(dataList, many=True).data

    def get_imageList(self, instance):
        imageList = SKUImage.objects.filter(skuId=instance.id)
        return SKUImageSerializer(imageList, many=True).data

    def get_optionValueList(self, instance):
        isDetail = getIsDetail(self)
        if isDetail == isDetailValue:
            languageId = getLanguage(self)
            dataList = SKUOptionValue.objects.filter(skuId=instance.id)
            return SKUOptionValueSerializer(
                dataList,
                context={languageKey: languageId, isDetailKey: isDetailValue},
                many=True,
            ).data

    def get_product(self, instance):
        dataList = Product.objects.filter(id=instance.productId.id)
        if dataList.__len__() > 0:
            languageId = getLanguage(self)
            return ProductBasicSerializer(
                dataList[0], context={languageKey: languageId}
            ).data


# Cart
class CartSerializer(serializers.ModelSerializer):
    isAuthorized = serializers.SerializerMethodField()
    sku = serializers.SerializerMethodField()

    class Meta:
        model = Cart
        fields = [
            "id",
            "quantity",
            "createdDate",
            "updatedDate",
            "skuId",
            "shoppingAccountId",
            "isAuthorized",
            "sku",
        ]

    def get_sku(self, instance):
        isDetail = getIsDetail(self)
        if isDetail == "1":
            currencyId = getCurrency(self)
            languageId = getLanguage(self)
            return SKUDetailSerializer(
                instance.skuId,
                context={
                    languageKey: languageId,
                    currencyKey: currencyId,
                    isDetailKey: isDetail,
                },
            ).data

    def get_isAuthorized(self, instance):
        errorMessage = ""
        shoppingAccountId = None
        parentId = None

        if self.context.__contains__("request"):
            parentId = self.context["request"].query_params.get("parentId", None)
        elif self.context.__contains__("parentId"):
            parentId = self.context["parentId"]

        if self.context.__contains__("request"):
            shoppingAccountId = self.context["request"].query_params.get(
                "shoppingAccountId", None
            )
        elif self.context.__contains__("shoppingAccountId"):
            shoppingAccountId = self.context["shoppingAccountId"]

        currentShoppingAccount = None

        if parentId is not None:
            parentId = int(parentId)
        else:
            errorMessage = "Parent Id is Required"
            raise serializers.ValidationError({"error": [errorMessage]})

        if shoppingAccountId is not None:
            shoppingAccountId = int(shoppingAccountId)
        else:
            errorMessage = "Shopping Account Id is Required"
            raise serializers.ValidationError({"error": [errorMessage]})

        currentShoppingAccountList = ShoppingAccount.objects.filter(
            id=shoppingAccountId
        )
        if currentShoppingAccountList.__len__() > 0:
            currentShoppingAccount = currentShoppingAccountList[0]
        else:
            errorMessage = "Shopping Account Not Found"
            raise serializers.ValidationError({"error": [errorMessage]})

        if currentShoppingAccount is not None:
            if parentId == currentShoppingAccount.parentId.id:
                return True
            else:
                errorMessage = "Parent Id do not Match"
                raise serializers.ValidationError({"error": [errorMessage]})
        else:
            errorMessage = "Shopping Account is None"
            raise serializers.ValidationError({"error": [errorMessage]})


# Order Status
class OrderStatusSerializer(serializers.ModelSerializer):
    class Meta:
        model = OrderStatus
        fields = ["id", "keyName", "createdDate", "updatedDate"]


class OrderStatusLanguageSerializer(serializers.ModelSerializer):
    class Meta:
        model = OrderStatusLanguage
        fields = [
            "id",
            "name",
            "createdDate",
            "updatedDate",
            "languageId",
            "orderStatusId",
        ]


# Place Order
class PlaceOrderSerializer(serializers.Serializer):
    parentId = serializers.IntegerField()
    shoppingAccountId = serializers.IntegerField()
    addressBookId = serializers.IntegerField()
    paymentMethodId = serializers.IntegerField()

    def validate(self, data):
        errorMessage = ""
        isCheck = True
        if "parentId" in data:
            isCheck = validateParentId(self, data["parentId"])
        else:
            errorMessage = "Parent Id does not exit"

        shoppingAccountId = data.get("shoppingAccountId")
        if shoppingAccountId is not None:
            shoppingAccountList = ShoppingAccount.objects.filter(id=shoppingAccountId)
            if shoppingAccountList.__len__() > 0:
                selected = shoppingAccountList[0]
                if selected.parentId.id != data["parentId"]:
                    errorMessage = "Parent Id does not match with Shopping Account"
            else:
                errorMessage = "Shopping Account does not exit"

        addressBookId = data.get("addressBookId")
        if addressBookId is not None:
            addressBookList = AddressBook.objects.filter(id=addressBookId)
            if addressBookList.__len__() > 0:
                selected = addressBookList[0]
                if selected.shoppingAccountId.id != shoppingAccountId:
                    errorMessage = (
                        "Shopping Account Id does not match with Address Book"
                    )
            else:
                errorMessage = "Address Book does not exit"

        paymentMethodId = data.get("paymentMethodId")
        if paymentMethodId is not None:
            paymentMethodList = PaymentMethod.objects.filter(id=paymentMethodId)
            if paymentMethodList.__len__() == 0:
                errorMessage = "Payment Method does not exit"

        if isCheck == True:
            return data

        elif len(errorMessage) > 0:
            raise serializers.ValidationError({"error": [errorMessage]})

    def create(self, validated_data):
        paymentMethod = PaymentMethod.objects.filter(
            id=validated_data["paymentMethodId"]
        ).first()

        selected = ShoppingAccount.objects.get(id=validated_data["shoppingAccountId"])

        addressBook = AddressBook.objects.filter(shoppingAccountId=selected).first()

        cartList = Cart.objects.filter(
            shoppingAccountId=validated_data["shoppingAccountId"]
        )
        if cartList.__len__() == 0:
            raise serializers.ValidationError({"error": "Cart is empty"})

        order = Order.objects.create(
            delivery=0.0,
            tax=0.0,
            orderStatusId=OrderStatus.objects.get(id=1),
            paymentMethodId=paymentMethod,
            storeId=selected.storeId,
            shoppingAccountId=selected,
            createdDate=datetime.now(),
            updatedDate=datetime.now(),
        )

        ShippingAddress.objects.create(
            phone=addressBook.phone,
            country=addressBook.country,
            city=addressBook.city,
            address=addressBook.address,
            postCode=addressBook.postCode,
            orderId=order,
            createdDate=datetime.now(),
            updatedDate=datetime.now(),
        )
        subTotal = 0.0
        for cart in cartList:
            ser = CartSerializer(
                cart,
                context={
                    "parentId": validated_data["parentId"],
                    "shoppingAccountId": selected.id,
                    "currencyId": selected.storeId.currencyId.id,
                    "isDetail": "1",
                },
            ).data

            subTotal += (
                ser["sku"]["priceList"][0]["salePrice"]
                + ser["sku"]["priceList"][0]["shippingCost"]
            ) * cart.quantity

            OrderItem.objects.create(
                pricePerItem=ser["sku"]["priceList"][0]["salePrice"],
                originalPricePerItem=ser["sku"]["priceList"][0]["originalPrice"],
                shippingCost=ser["sku"]["priceList"][0]["shippingCost"],
                quantity=cart.quantity,
                createdDate=datetime.now(),
                updatedDate=datetime.now(),
                skuId=SKU.objects.filter(id=ser["sku"]["id"]).first(),
                orderId=order,
                currencyId=selected.storeId.currencyId,
            )

            SKU.objects.filter(id=ser["sku"]["id"]).update(
                stock=F("stock") - cart.quantity, updatedDate=datetime.now()
            )

        subTotal = subTotal + order.delivery

        Cart.objects.filter(
            shoppingAccountId=validated_data["shoppingAccountId"]
        ).delete()
        paymentIntent = create_payment_intent(
            subTotal, order.id, selected.storeId.currencyId.code
        )

        return JsonResponse(paymentIntent, safe=False)


# Order
class OrderSerializer(serializers.ModelSerializer):
    class Meta:
        model = Order
        fields = [
            "id",
            "delivery",
            "tax",
            "createdDate",
            "updatedDate",
            "orderStatusId",
            "paymentMethodId",
            "storeId",
            "shoppingAccountId",
        ]


class OrderItemSerializer(serializers.ModelSerializer):
    class Meta:
        model = OrderItem
        fields = [
            "id",
            "pricePerItem",
            "originalPricePerItem",
            "shippingCost",
            "quantity",
            "createdDate",
            "updatedDate",
            "skuId",
            "orderId",
            "currencyId",
        ]


class ShippingAddressSerializer(serializers.ModelSerializer):
    class Meta:
        model = ShippingAddress
        fields = [
            "id",
            "phone",
            "country",
            "city",
            "address",
            "postCode",
            "orderId",
            "createdDate",
            "updatedDate",
        ]
