# Purpose: header variables factory
# Copyright (c) 2010-2021, Manfred Moitzi
# License: MIT License
from typing import Sequence, Union
from .types import DXFVertex, DXFTag, cast_tag_value


def SingleValue(value: Union[str, float], code: int = 1) -> DXFTag:
    return DXFTag(code, cast_tag_value(code, value))


def Point2D(value: Sequence[float]) -> DXFVertex:
    return DXFVertex(10, (value[0], value[1]))


def Point3D(value: Sequence[float]) -> DXFVertex:
    return DXFVertex(10, (value[0], value[1], value[2]))


class HeaderVarDef:
    def __init__(self, name, code, factory, mindxf, maxdxf, priority,
                 default=None):
        self.name = name
        self.code = code
        self.factory = factory
        self.mindxf = mindxf
        self.maxdxf = maxdxf
        self.priority = priority
        self.default = default

@@ -1,40 +1,4 @@
-# Purpose: header variables factory%0A
 # Co
@@ -92,16 +92,53 @@
 e, Union
+, Callable, Any, NamedTuple, Optional
 %0Afrom .t
@@ -538,116 +538,26 @@
 rDef
-:%0A    def __init__(self, name, code, factory, mindxf, maxdxf, priority,%0A                 default=Non
+(NamedTupl
 e):%0A    
     
@@ -556,203 +556,146 @@
     
-   
- self.name = name%0A        self.code = code%0A        self.factory = factory%0A        self.mindxf = mindxf%0A        self.maxdxf = maxdxf%0A        self.priority = priority%0A        self.default = default
+name: str%0A    code: int%0A    factory: Callable%5B%5BAny%5D, Any%5D%0A    mindxf: str%0A    maxdxf: str%0A    priority: int%0A    default: Optional%5BAny%5D = None
 %0A

implement HeaderVarDef as NamedTuple