// 📦 Product Entity
// @Entity
// @Table(name = "products")

print "📦 Loading Product Entity...";

// @Entity
// @Table(name = "products")
function Product(id, name, price, category) {
    print "📦 Entity: Product";
    return "Product:" + str(id) + ":" + name + ":" + str(price) + ":" + category;
}

// Entity metadata for auto-table creation
function Product_getTableSchema() {
    print "📦 Getting Product table schema...";
    
    let schema = {};
    return schema;
}

// Validation rules
function Product_validate(name, price, category) {
    print "✅ Validating Product data...";
    
    if (len(name) < 2) {
        print "❌ Validation error: Product name too short";
        return false;
    }
    
    if (price <= 0) {
        print "❌ Validation error: Price must be positive";
        return false;
    }
    
    if (len(category) < 1) {
        print "❌ Validation error: Category required";
        return false;
    }
    
    print "✅ Product validation passed";
    return true;
}

print "✅ Product Entity loaded successfully";
