# -*- coding: utf-8 -*-
# Copyright (c) 2021 CloudZero - ALL RIGHTS RESERVED - PROPRIETARY AND CONFIDENTIAL
# Unauthorized copying of this file and/or project, via any medium is strictly prohibited.
# Direct all questions to legal@cloudzero.com
from enum import Enum
from typing import Dict, List, NamedTuple, Optional

from .common import invokes_billing_api
from .types import GranularityType


class TimespanUnit(Enum):
    hours = 'hours'
    days = 'days'
    weeks = 'weeks'
    months = 'months'
    years = 'years'


class InterfaceViewTimespan(NamedTuple):
    unit: TimespanUnit
    value: int


class InterfaceViewDefinition(NamedTuple):
    name: str
    dimensions: Dict[str, str]
    granularity: GranularityType = GranularityType.daily
    timespan: Optional[InterfaceViewTimespan] = None
    filters: Dict[str, List[str]] = {}


@invokes_billing_api(api='update-interface-view-definitions-v2')
def update_interface_view_definitions(organization_id: str,
                                      definitions: List[InterfaceViewDefinition]):
    pass
