

from m2m.m2mcli import download_hv
from m2m.api import *
from cytoolz import thread_last
import m2m

import config
username = config.USERNAME
password = config.PASSWORD

h = 3
v = 9

# download_hv(username, password, h, v,
# region='CU', ceph=False, endpoint_url=None, aws_profile=None,
# outroot='/home/rhussain/rezatemp/', resume=True, cpu=5, batch_size=100)
region = "CU"




# def create_product_list(api, h, v, region) -> list[dict]:
#     return thread_last(
#         ard_entityids(api, region, h, v),
#         (ard_order_ids, api),
#     )

def ls_st_bandnumbers(sensor: str) -> List[int]:
    """
    ST band numbers for the given sensor
    LC09 LC08 LE07 LT05 LT04
    """
    if sensor == 'LC09':
        return [10, 11]
    elif sensor == 'LC08':
        return [10, 11]
    elif sensor == 'LE07':
        return [6]
    elif sensor == 'LT05':
        return [6]
    elif sensor == 'LT04':
        return [6]
    else:
        raise ValueError

with M2M(username, password) as api:
    entity_ids = m2m.persist.ard_entityids(api, region, h, v)
    products = api.available_products('landsat_ard_tile_c2', entity_ids)

    #product_list = create_product_list(api, h, v, region)
    ABC = None