package com.cloudhandson.vpdbackoffice.web;

import com.cloudhandson.vpdbackoffice.config.ProductProperties;
import com.cloudhandson.vpdbackoffice.config.McpProperties;
import com.cloudhandson.vpdbackoffice.service.DataCatalog;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ModelAttribute;

@ControllerAdvice
public class ProductModelAdvice {
  private final ProductProperties product;
  private final DataCatalog catalog;
  private final McpProperties mcp;
  public ProductModelAdvice(ProductProperties product, DataCatalog catalog, McpProperties mcp) {
    this.product = product;
    this.catalog = catalog;
    this.mcp = mcp;
  }
  @ModelAttribute("product")
  ProductProperties product() { return product; }
  @ModelAttribute("catalogOwner")
  String catalogOwner() { return catalog.owner(); }
  @ModelAttribute("mcp")
  McpProperties mcp() { return mcp; }
}
