from .core import _get

def reformat_deployment_info(dep_info: dict) -> dict:
    del dep_info['@class']
    del dep_info['dataSource']
    return dep_info

def get_deployment_info(subsite, node, instrument, deployment: int, reformat: bool = True) -> list[dict]:
    base_url = 'https://ooinet.oceanobservatories.org/api/m2m/12587/events/deployment/inv/'
    deployment_url = '/'.join([base_url, subsite, node, instrument, str(deployment)])
    json_data = _get(deployment_url)
    if reformat is True:
        json_data = [reformat_deployment_info(data) for data in json_data]
    return json_data
