{
  "id": "products",
  "label": "Productos",
  "description": "Catálogo de productos y precios.",
  "entities": [
    {
      "name": "product",
      "label": "Producto",
      "fields": [
        { "name": "sku", "label": "SKU", "kind": "text", "required": true, "help": "Código único" },
        { "name": "name", "label": "Nombre", "kind": "text", "required": true },
        { "name": "category", "label": "Categoría", "kind": "text", "required": false },
        { "name": "price", "label": "Precio unitario", "kind": "number", "required": true, "default": "0" },
        { "name": "stock", "label": "Stock disponible", "kind": "number", "default": "0" },
        { "name": "active", "label": "En venta", "kind": "boolean", "default": "true" }
      ]
    }
  ],
  "menu": [
    { "label": "Catálogo", "view": "list", "icon": "📦" },
    { "label": "Nuevo producto", "view": "form", "icon": "✚" }
  ],
  "views": {
    "list": {
      "kind": "list",
      "title": "Catálogo de productos",
      "entity": "product",
      "columns": [
        { "field": "sku", "label": "SKU", "weight": 1.0 },
        { "field": "name", "label": "Nombre", "weight": 2.5 },
        { "field": "category", "label": "Categoría", "weight": 1.5 },
        { "field": "price", "label": "Precio", "weight": 1.0 },
        { "field": "stock", "label": "Stock", "weight": 0.8 },
        { "field": "active", "label": "Activo", "weight": 0.6 }
      ],
      "actions": [
        { "kind": "open_view", "view": "form", "label": "✚ Nuevo" }
      ],
      "search_in": ["sku", "name", "category"]
    },
    "form": {
      "kind": "form",
      "title": "Nuevo producto",
      "entity": "product",
      "fields": [
        { "name": "sku", "label": "SKU", "kind": "text", "required": true },
        { "name": "name", "label": "Nombre", "kind": "text", "required": true },
        { "name": "category", "label": "Categoría", "kind": "text" },
        { "name": "price", "label": "Precio", "kind": "number", "required": true, "default": "0" },
        { "name": "stock", "label": "Stock inicial", "kind": "number", "default": "0" },
        { "name": "active", "label": "En venta", "kind": "boolean", "default": "true" }
      ],
      "on_submit": {
        "kind": "seed_entity",
        "entity": "product",
        "next_view": "list"
      }
    }
  }
}
