Same label with different parameter in index page (different devices)

Hi!
Is there any way to add and if/else clause (or similar) to show differents parameters for the same label taking into consideration the DeviceId.ProductClass?

Example

- components:
    - type: "'parameter'"
  label: "'Serial Number'"
  parameter: DeviceID.SerialNumber
  type: "'device-link'"
- label: "'Model'"
  parameter: DeviceID.ProductClass
- label: "'Firmware'"
  parameter: InternetGatewayDevice.DeviceInfo.SoftwareVersion
- label: "'Info label'"
  parameter: if(DeviceId.ProductClass == potato) { InternetGatewayDevice.WANDevice.2.WANConnectionDevice.1.WANPPPConnection.1.Username}
else {InternetGatewayDevice.WANDevice.2.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress}
- label: "'Uptime (h)'"
  parameter: InternetGatewayDevice.DeviceInfo.UpTime

Thanks!

I’ve been looking into the docs and I think the intended way to do this is using VirtualParamerts, right?
Using the example above the code for this VirtualParameter is:

const now = Date.now();
let productClass = declare("DeviceID.ProductClass", {value: 1}).value[0];
let client = "";

switch(productClass) {
  case "model1":
    client = declare("InternetGatewayDevice.WANDevice.2.WANConnectionDevice.1.WANPPPConnection.1.Username", {value: now}).value[0];
    break;
  case "model2":
    client = declare("InternetGatewayDevice.WANDevice.2.WANConnectionDevice.1.WANPPPConnection.1.Username", {value: now}).value[0];
    break;
  case "model3":
    client = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username", {value: now}).value[0];
    break;
  default:
    client = "not supported";
} 

return {writable: false, value: [client, "xsd:string"]};

model1 and model2 use the same parameter, model 3 uses another.

Any thoughts? Could this be done more efficiently?

Thanks!