package com.cloudhandson.vpdbackoffice.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * Names the customer-owned DB view used to resolve game query scopes.
 *
 * <p>The view is a stable integration contract, not a Smilegate-specific table.
 * Each environment can expose its own game master, alias source, and approved
 * object inventory behind this view without changing application code.</p>
 */
@ConfigurationProperties(prefix = "backoffice.game-scope")
public record GameScopeProperties(
    boolean enabled,
    String viewName,
    int maxScopes
) {

  public boolean configured() {
    return enabled && viewName != null && !viewName.isBlank();
  }

  public int resolvedMaxScopes() {
    return maxScopes >= 1 && maxScopes <= 20 ? maxScopes : 8;
  }
}
