from typing import Iterable

from tdm.abstract.datamodel import AbstractDomainType
from tdm.datamodel.domain import DocumentType, Domain

from tp_interfaces.domain.model.types import PropertyType
from ._common import STR_VALUE


def generate_types(domain: Domain) -> Iterable[AbstractDomainType]:
    result = []
    for doc_type in domain.get_types(DocumentType):
        result.append(PropertyType('Рубрика', doc_type, STR_VALUE, id=f'{doc_type.id}:category'))
    if result:
        result.append(STR_VALUE)
    return result
