Skip to main content

Domain Models

The domain layer models represent the core business entities in the TecMeli application. These models are used throughout the application to represent products and their associated data.

Product

Simplified product model used primarily for displaying basic information in search result listings.

Definition

data class Product(
    val id: String,
    val title: String,
    val thumbnail: String? = null,
    val domainId: String? = null,
    val lastUpdated: String? = null,
    val attributes: List<ProductAttribute> = emptyList()
)

Properties

id
String
required
Unique product identifier
title
String
required
Product name or title
thumbnail
String?
default:"null"
URL of the product thumbnail image
domainId
String?
default:"null"
Category or domain identifier
lastUpdated
String?
default:"null"
Date of the product’s last update
attributes
List<ProductAttribute>
default:"emptyList()"
List of key product attributes

Usage Example

val product = Product(
    id = "MCO12345",
    title = "Samsung Galaxy S21",
    thumbnail = "https://example.com/thumbnail.jpg",
    domainId = "MCO-CELLPHONES",
    lastUpdated = "2024-03-15T10:30:00Z",
    attributes = listOf(
        ProductAttribute("COLOR", "Color", "Black"),
        ProductAttribute("STORAGE", "Storage", "128GB")
    )
)

ProductDetail

Detailed product model containing comprehensive information for the product detail view.

Definition

data class ProductDetail(
    val id: String,
    val title: String,
    val pictures: List<String> = emptyList(),
    val attributes: List<ProductAttribute> = emptyList(),
    val description: String? = null
)

Properties

id
String
required
Unique product identifier
title
String
required
Complete product name or title
pictures
List<String>
default:"emptyList()"
List of product image URLs
attributes
List<ProductAttribute>
default:"emptyList()"
Complete list of product attributes and technical specifications
description
String?
default:"null"
Textual description of the product

Usage Example

val productDetail = ProductDetail(
    id = "MCO12345",
    title = "Samsung Galaxy S21 128GB Black",
    pictures = listOf(
        "https://example.com/image1.jpg",
        "https://example.com/image2.jpg",
        "https://example.com/image3.jpg"
    ),
    attributes = listOf(
        ProductAttribute("COLOR", "Color", "Black"),
        ProductAttribute("STORAGE", "Storage", "128GB"),
        ProductAttribute("RAM", "RAM", "8GB")
    ),
    description = "Latest Samsung flagship with advanced camera features"
)

ProductAttribute

Represents a product attribute or technical specification.

Definition

data class ProductAttribute(
    val id: String,
    val name: String,
    val value: String?
)

Properties

id
String
required
Attribute identifier (e.g., “COLOR”, “STORAGE”)
name
String
required
Human-readable attribute name (e.g., “Color”, “Storage”)
value
String?
Attribute value (e.g., “Red”, “128GB”)

Usage Example

val colorAttribute = ProductAttribute(
    id = "COLOR",
    name = "Color",
    value = "Midnight Black"
)

val storageAttribute = ProductAttribute(
    id = "STORAGE_CAPACITY",
    name = "Storage Capacity",
    value = "256GB"
)

Package Location

com.alcalist.tecmeli.domain.model
All domain models are located in the domain.model package following Clean Architecture principles, ensuring separation from data layer DTOs and UI layer models.

Build docs developers (and LLMs) love