# -*- coding: utf-8 -*-
# Copyright (c) 2017 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
import typing


class PartitionType(str):
    accounts: 'PartitionType'
    services: 'PartitionType'
    resources: 'PartitionType'
    product_family: 'PartitionType'
    usage_type: 'PartitionType'
    operation: 'PartitionType'
    region: 'PartitionType'
    cost_group: 'PartitionType'
    feature: 'PartitionType'
    product: 'PartitionType'
    k8s_cluster: 'PartitionType'
    k8s_pod: 'PartitionType'
    k8s_workload: 'PartitionType'
    k8s_namespace: 'PartitionType'
    cloud_provider: 'PartitionType'
    line_item_type: 'PartitionType'
    description: 'PartitionType'
    request_type: 'PartitionType'
    transfer_type: 'PartitionType'
    pricing_term: 'PartitionType'
    invoice_id: 'PartitionType'
    payer_account_id: 'PartitionType'
    billing_period: 'PartitionType'
    committed_use_subscription: 'PartitionType'
    billing_connection_id: 'PartitionType'
    pricing_unit: 'PartitionType'

    @classmethod
    def for_tag(cls, tag_value: str) -> 'PartitionType':
        return cls(f'tag:{tag_value}')

    @classmethod
    def for_k8s_label(cls, label_value: str) -> 'PartitionType':
        return cls(f'k8slabel:{label_value}')

    @classmethod
    def for_cost_context(cls, cost_context_value: str) -> 'PartitionType':
        return cls(f'costcontext:{cost_context_value}')

    def exclude(self) -> 'PartitionType':
        return PartitionType(f'!{str(self)}')


for v, t in typing.get_type_hints(PartitionType).items():
    if t == PartitionType and not hasattr(PartitionType, v):
        setattr(PartitionType, v, PartitionType(v))
