"""Interface for the ows-royalties microservice.""" from typing import Any, Dict, List from owsrequest import request as requests import config from src.utils import constants def get_all_active_contract_mechanical_deductions() -> List[Dict[str, Any]]: """ Fetch active mechanical deductions contracts for a given date. Returns: List[Dict[str, Any]]: List of active mechanical deduction contract dictionaries. """ try: response = requests.process( application=config.APPLICATION_NAME, environment=config.ENVIRONMENT, method='GET', service_name=constants.OWS_ROYALTIES, path='/contracts/mechanical-deductions/active' ) if response.status_code != 200: raise Exception(f'Royalties API error {response.status_code}: {response.text}') return response.json() except Exception as e: raise RuntimeError( f'Failed to fetch active abacus contracts. Error: {e}' )