package id.iiyh.inatrading.feature.product.data.model

import com.google.gson.annotations.SerializedName

data class ProductItem(
    val id: String,
    val image: String? = null,
    val isFavorite: Boolean = false,
    val market: String? = null,
    val maxPrice: Double = 0.0,
    val minPrice: Double = 0.0,
    val name: String,
    val totalStock: Int = 0,
)

data class ProductListResponse(
    val responseCode: String? = null,
    val responseDesc: String? = null,
    val rows: List<ProductItem> = emptyList(),
    val totalItem: Int = 0,
    val totalPage: Int = 0,
) {
    val isSuccess: Boolean get() = responseCode == "0000"
}

data class ProductDetailResponse(
    val responseCode: String? = null,
    val responseDesc: String? = null,
    val data: ProductDetail? = null,
) {
    val isSuccess: Boolean get() = responseCode == "0000"
}

data class ProductDetail(
    val id: String,
    val description: String? = null,
    @SerializedName(value = "image", alternate = ["imageId"])
    val image: String? = null,
    val isEligibleToExport: Boolean = false,
    val isNew: Boolean = false,
    val isPreOrder: Boolean = false,
    val name: String,
    val preOrderDay: Int? = null,
    val productFiles: List<String> = emptyList(),
    val productFeatures: List<String> = emptyList(),
    val productImages: List<ProductImage> = emptyList(),
    val productInformations: List<ProductInformation> = emptyList(),
    val categoryInformations: List<ProductInformation> = emptyList(),
    val productKeyWords: List<String> = emptyList(),
    val productModels: List<ProductModel> = emptyList(),
    val seller: ProductSeller? = null,
    val subCategory: ProductSubCategory? = null,
    val state: String? = null,
    val complianceInformation: ComplianceInformation? = null,
    val warrantyInformation: WarrantyInformation? = null,
)

data class ProductImage(
    val id: String? = null,
    @SerializedName(value = "image", alternate = ["imageId"])
    val image: String? = null,
    val sequence: Int = 0,
)

data class ProductInformation(
    val id: String? = null,
    val paramName: String? = null,
    val paramValue: String? = null,
)

data class ProductModel(
    val id: String? = null,
    val currency: String? = null,
    val dimensionType: String? = null,
    val height: Double? = null,
    @SerializedName(value = "image", alternate = ["imageId"])
    val image: String? = null,
    val isConfigurePromotionPrice: Boolean = false,
    val isMeasurement: Boolean = false,
    val name: String? = null,
    val price: Double? = null,
    val sku: String? = null,
    val warehouses: List<ProductWarehouse> = emptyList(),
    val weight: Double? = null,
    val weightType: String? = null,
    val width: Double? = null,
    val length: Double? = null,
    val promotionPrice: Double? = null,
    val promotionCurrency: String? = null,
    val packagingWeight: Double? = null,
    val packagingWeightType: String? = null,
    val packagingLength: Double? = null,
    val packagingWidth: Double? = null,
    val packagingHeight: Double? = null,
    val packagingDimensionType: String? = null,
    val productMeasurements: List<ProductMeasurement> = emptyList(),
)

data class ProductWarehouse(
    val id: String,
    val address: String? = null,
    val country: String? = null,
    val province: String? = null,
    val city: String? = null,
    val postalCode: String? = null,
    val latitude: Double? = null,
    val longitude: Double? = null,
    val stock: Int = 0,
)

data class ProductSeller(
    val id: String,
    val image: String? = null,
    val name: String? = null,
)

data class ProductSubCategory(
    val id: String,
    val name: String? = null,
)

data class ProductMeasurement(
    val id: String? = null,
    val measurementType: String? = null,
    val measurementValue: String? = null,
    val price: Double? = null,
    val promotionPrice: Double? = null,
    val weight: Double? = null,
    val weightType: String? = null,
    val length: Double? = null,
    val width: Double? = null,
    val height: Double? = null,
    val dimensionType: String? = null,
    val warehouses: List<ProductWarehouse> = emptyList(),
)

data class ComplianceInformation(
    val safetyWarning: String? = null,
    val countryOfOrigin: String? = null,
    val isDangerousGoodRegulation: Boolean? = null,
    val fileId: String? = null,
)

data class WarrantyInformation(
    val type: String? = null,
    val duration: Int? = null,
    val durationType: String? = null,
)
