# Copyright (C) 2014-2018, Manfred Moitzi
# License: MIT License
# Just one header var definition for all DXF version needed, because AutoCAD ignores unknown header vars
from __future__ import unicode_literals
from functools import partial

from ezdxf.lldxf.hdrvars import SingleValue, Point2D, Point3D

VARMAP = {
    '$3DDWFPREC': partial(SingleValue, code=40),
    '$ACADMAINTVER': partial(SingleValue, code=70),  # AC1032 changed to code=90
    '$ACADVER': partial(SingleValue, code=1),
    '$ANGBASE': partial(SingleValue, code=50),
    '$ANGDIR': partial(SingleValue, code=70),
    '$ATTMODE': partial(SingleValue, code=70),
    '$AUNITS': partial(SingleValue, code=70),
    '$AUPREC': partial(SingleValue, code=70),
    '$CAMERADISPLAY': partial(SingleValue, code=290),
    '$CAMERAHEIGHT': partial(SingleValue, code=40),
    '$CECOLOR': partial(SingleValue, code=62),
    '$CELTSCALE': partial(SingleValue, code=40),
    '$CELTYPE': partial(SingleValue, code=6),
    '$CELWEIGHT': partial(SingleValue, code=370),
    '$CEPSNTYPE': partial(SingleValue, code=380),
    '$CHAMFERA': partial(SingleValue, code=40),
    '$CHAMFERB': partial(SingleValue, code=40),
    '$CHAMFERC': partial(SingleValue, code=40),
    '$CHAMFERD': partial(SingleValue, code=40),
    '$CLAYER': partial(SingleValue, code=8),
    '$CMATERIAL': partial(SingleValue, code=347),
    '$CMLJUST': partial(SingleValue, code=70),
    '$CMLSCALE': partial(SingleValue, code=40),
    '$CMLSTYLE': partial(SingleValue, code=2),
    '$CSHADOW': partial(SingleValue, code=280),
    '$DGNFRAME': partial(SingleValue, code=280),
    '$DIMADEC': partial(SingleValue, code=70),
    '$DIMALT': partial(SingleValue, code=70),
    '$DIMALTD': partial(SingleValue, code=70),
    '$DIMALTF': partial(SingleValue, code=40),
    '$DIMALTRND': partial(SingleValue, code=40),
    '$DIMALTTD': partial(SingleValue, code=70),
    '$DIMALTTZ': partial(SingleValue, code=70),
    '$DIMALTU': partial(SingleValue, code=70),
    '$DIMALTZ': partial(SingleValue, code=70),
    '$DIMAPOST': partial(SingleValue, code=1),
    '$DIMARCSYM': partial(SingleValue, code=70),
    '$DIMASO': partial(SingleValue, code=70),
    '$DIMASSOC': partial(SingleValue, code=280),
    '$DIMASZ': partial(SingleValue, code=40),
    '$DIMATFIT': partial(SingleValue, code=70),
    '$DIMAUNIT': partial(SingleValue, code=70),
    '$DIMAZIN': partial(SingleValue, code=70),
    '$DIMBLK': partial(SingleValue, code=1),
    '$DIMBLK1': partial(SingleValue, code=1),
    '$DIMBLK2': partial(SingleValue, code=1),
    '$DIMCEN': partial(SingleValue, code=40),
    '$DIMCLRD': partial(SingleValue, code=70),
    '$DIMCLRE': partial(SingleValue, code=70),
    '$DIMCLRT': partial(SingleValue, code=70),
    '$DIMDEC': partial(SingleValue, code=70),
    '$DIMDLE': partial(SingleValue, code=40),
    '$DIMDLI': partial(SingleValue, code=40),
    '$DIMDSEP': partial(SingleValue, code=70),
    '$DIMEXE': partial(SingleValue, code=40),
    '$DIMEXO': partial(SingleValue, code=40),
    '$DIMFRAC': partial(SingleValue, code=70),
    '$DIMFXL': partial(SingleValue, code=40),
    '$DIMFXLON': partial(SingleValue, code=70),
    '$DIMGAP': partial(SingleValue, code=40),
    '$DIMJOGANG': partial(SingleValue, code=40),
    '$DIMJUST': partial(SingleValue, code=70),
    '$DIMLDRBLK': partial(SingleValue, code=1),
    '$DIMLFAC': partial(SingleValue, code=40),
    '$DIMLIM': partial(SingleValue, code=70),
    '$DIMLTEX1': partial(SingleValue, code=6),
    '$DIMLTEX2': partial(SingleValue, code=6),
    '$DIMLTYPE': partial(SingleValue, code=6),
    '$DIMLUNIT': partial(SingleValue, code=70),
    '$DIMLWD': partial(SingleValue, code=70),
    '$DIMLWE': partial(SingleValue, code=70),
    '$DIMPOST': partial(SingleValue, code=1),
    '$DIMRND': partial(SingleValue, code=40),
    '$DIMSAH': partial(SingleValue, code=70),
    '$DIMSCALE': partial(SingleValue, code=40),
    '$DIMSD1': partial(SingleValue, code=70),
    '$DIMSD2': partial(SingleValue, code=70),
    '$DIMSE1': partial(SingleValue, code=70),
    '$DIMSE2': partial(SingleValue, code=70),
    '$DIMSHO': partial(SingleValue, code=70),
    '$DIMSOXD': partial(SingleValue, code=70),
    '$DIMSTYLE': partial(SingleValue, code=2),
    '$DIMTAD': partial(SingleValue, code=70),
    '$DIMTDEC': partial(SingleValue, code=70),
    '$DIMTFAC': partial(SingleValue, code=40),
    '$DIMTFILL': partial(SingleValue, code=70),
    '$DIMTFILLCLR': partial(SingleValue, code=70),
    '$DIMTIH': partial(SingleValue, code=70),
    '$DIMTIX': partial(SingleValue, code=70),
    '$DIMTM': partial(SingleValue, code=40),
    '$DIMTMOVE': partial(SingleValue, code=70),
    '$DIMTOFL': partial(SingleValue, code=70),
    '$DIMTOH': partial(SingleValue, code=70),
    '$DIMTOL': partial(SingleValue, code=70),
    '$DIMTOLJ': partial(SingleValue, code=70),
    '$DIMTP': partial(SingleValue, code=40),
    '$DIMTSZ': partial(SingleValue, code=40),
    '$DIMTVP': partial(SingleValue, code=40),
    '$DIMTXSTY': partial(SingleValue, code=7),
    '$DIMTXT': partial(SingleValue, code=40),
    '$DIMTXTDIRECTION': partial(SingleValue, code=70),
    '$DIMTZIN': partial(SingleValue, code=70),
    '$DIMUPT': partial(SingleValue, code=70),
    '$DIMZIN': partial(SingleValue, code=70),
    '$DISPSILH': partial(SingleValue, code=70),
    '$DWFFRAME': partial(SingleValue, code=280),
    '$DWGCODEPAGE': partial(SingleValue, code=3),
    '$ELEVATION': partial(SingleValue, code=40),
    '$ENDCAPS': partial(SingleValue, code=280),
    '$EXTMAX': Point3D,
    '$EXTMIN': Point3D,
    '$EXTNAMES': partial(SingleValue, code=290),
    '$FILLETRAD': partial(SingleValue, code=40),
    '$FILLMODE': partial(SingleValue, code=70),
    '$FINGERPRINTGUID': partial(SingleValue, code=2),
    '$HALOGAP': partial(SingleValue, code=280),
    '$HANDSEED': partial(SingleValue, code=5),
    '$HIDETEXT': partial(SingleValue, code=280),
    '$HYPERLINKBASE': partial(SingleValue, code=1),
    '$INDEXCTL': partial(SingleValue, code=280),
    '$INSBASE': Point3D,
    '$INSUNITS': partial(SingleValue, code=70),
    '$INTERFERECOLOR': partial(SingleValue, code=62),
    '$INTERFEREOBJVS': partial(SingleValue, code=345),
    '$INTERFEREVPVS': partial(SingleValue, code=346),
    '$INTERSECTIONCOLOR': partial(SingleValue, code=70),
    '$INTERSECTIONDISPLAY': partial(SingleValue, code=280),
    '$JOINSTYLE': partial(SingleValue, code=280),
    '$LASTSAVEDBY': partial(SingleValue, code=1),
    '$LATITUDE': partial(SingleValue, code=40),
    '$LENSLENGTH': partial(SingleValue, code=40),
    '$LIGHTGLYPHDISPLAY': partial(SingleValue, code=280),
    '$LIMCHECK': partial(SingleValue, code=70),
    '$LIMMAX': Point2D,
    '$LIMMIN': Point2D,
    '$LOFTANG1': partial(SingleValue, code=40),
    '$LOFTANG2': partial(SingleValue, code=40),
    '$LOFTMAG1': partial(SingleValue, code=40),
    '$LOFTMAG2': partial(SingleValue, code=40),
    '$LOFTNORMALS': partial(SingleValue, code=280),
    '$LOFTPARAM': partial(SingleValue, code=70),
    '$LONGITUDE': partial(SingleValue, code=40),
    '$LTSCALE': partial(SingleValue, code=40),
    '$LUNITS': partial(SingleValue, code=70),
    '$LUPREC': partial(SingleValue, code=70),
    '$LWDISPLAY': partial(SingleValue, code=290),
    '$MAXACTVP': partial(SingleValue, code=70),
    '$MEASUREMENT': partial(SingleValue, code=70),
    '$MENU': partial(SingleValue, code=1),
    '$MIRRTEXT': partial(SingleValue, code=70),
    '$NORTHDIRECTION': partial(SingleValue, code=40),
    '$OBSCOLOR': partial(SingleValue, code=70),
    '$OBSLTYPE': partial(SingleValue, code=280),
    '$OLESTARTUP': partial(SingleValue, code=290),
    '$ORTHOMODE': partial(SingleValue, code=70),
    '$PDMODE': partial(SingleValue, code=70),
    '$PDSIZE': partial(SingleValue, code=40),
    '$PELEVATION': partial(SingleValue, code=40),
    '$PEXTMAX': Point3D,
    '$PEXTMIN': Point3D,
    '$PINSBASE': Point3D,
    '$PLIMCHECK': partial(SingleValue, code=70),
    '$PLIMMAX': Point2D,
    '$PLIMMIN': Point2D,
    '$PLINEGEN': partial(SingleValue, code=70),
    '$PLINEWID': partial(SingleValue, code=40),
    '$PROJECTNAME': partial(SingleValue, code=1),
    '$PROXYGRAPHICS': partial(SingleValue, code=70),
    '$PSLTSCALE': partial(SingleValue, code=70),
    '$PSOLHEIGHT': partial(SingleValue, code=40),
    '$PSOLWIDTH': partial(SingleValue, code=40),
    '$PSTYLEMODE': partial(SingleValue, code=290),
    '$PSVPSCALE': partial(SingleValue, code=40),
    '$PUCSBASE': partial(SingleValue, code=2),
    '$PUCSNAME': partial(SingleValue, code=2),
    '$PUCSORG': Point3D,
    '$PUCSORGBACK': Point3D,
    '$PUCSORGBOTTOM': Point3D,
    '$PUCSORGFRONT': Point3D,
    '$PUCSORGLEFT': Point3D,
    '$PUCSORGRIGHT': Point3D,
    '$PUCSORGTOP': Point3D,
    '$PUCSORTHOREF': partial(SingleValue, code=2),
    '$PUCSORTHOVIEW': partial(SingleValue, code=70),
    '$PUCSXDIR': Point3D,
    '$PUCSYDIR': Point3D,
    '$QTEXTMODE': partial(SingleValue, code=70),
    '$REALWORLDSCALE': partial(SingleValue, code=290),
    '$REGENMODE': partial(SingleValue, code=70),
    '$REQUIREDVERSIONS': partial(SingleValue, code=160),
    '$SHADEDGE': partial(SingleValue, code=70),
    '$SHADEDIF': partial(SingleValue, code=70),
    '$SHADOWPLANELOCATION': partial(SingleValue, code=40),
    '$SHOWHIST': partial(SingleValue, code=280),
    '$SKETCHINC': partial(SingleValue, code=40),
    '$SKPOLY': partial(SingleValue, code=70),
    '$SOLIDHIST': partial(SingleValue, code=280),
    '$SORTENTS': partial(SingleValue, code=280),
    '$SPLFRAME': partial(SingleValue, code=70),
    '$SPLINESEGS': partial(SingleValue, code=70),
    '$SPLINETYPE': partial(SingleValue, code=70),
    '$STEPSIZE': partial(SingleValue, code=40),
    '$STEPSPERSEC': partial(SingleValue, code=40),
    '$STYLESHEET': partial(SingleValue, code=1),
    '$SURFTAB1': partial(SingleValue, code=70),
    '$SURFTAB2': partial(SingleValue, code=70),
    '$SURFTYPE': partial(SingleValue, code=70),
    '$SURFU': partial(SingleValue, code=70),
    '$SURFV': partial(SingleValue, code=70),
    '$TDCREATE': partial(SingleValue, code=40),
    '$TDINDWG': partial(SingleValue, code=40),
    '$TDUCREATE': partial(SingleValue, code=40),
    '$TDUPDATE': partial(SingleValue, code=40),
    '$TDUSRTIMER': partial(SingleValue, code=40),
    '$TDUUPDATE': partial(SingleValue, code=40),
    '$TEXTSIZE': partial(SingleValue, code=40),
    '$TEXTSTYLE': partial(SingleValue, code=7),
    '$THICKNESS': partial(SingleValue, code=40),
    '$TILEMODE': partial(SingleValue, code=70),
    '$TILEMODELIGHTSYNCH': partial(SingleValue, code=280),
    '$TIMEZONE': partial(SingleValue, code=70),
    '$TRACEWID': partial(SingleValue, code=40),
    '$TREEDEPTH': partial(SingleValue, code=70),
    '$UCSBASE': partial(SingleValue, code=2),
    '$UCSNAME': partial(SingleValue, code=2),
    '$UCSORG': Point3D,
    '$UCSORGBACK': Point3D,
    '$UCSORGBOTTOM': Point3D,
    '$UCSORGFRONT': Point3D,
    '$UCSORGLEFT': Point3D,
    '$UCSORGRIGHT': Point3D,
    '$UCSORGTOP': Point3D,
    '$UCSORTHOREF': partial(SingleValue, code=2),
    '$UCSORTHOVIEW': partial(SingleValue, code=70),
    '$UCSXDIR': Point3D,
    '$UCSYDIR': Point3D,
    '$UNITMODE': partial(SingleValue, code=70),
    '$USERI1': partial(SingleValue, code=70),
    '$USERI2': partial(SingleValue, code=70),
    '$USERI3': partial(SingleValue, code=70),
    '$USERI4': partial(SingleValue, code=70),
    '$USERI5': partial(SingleValue, code=70),
    '$USERR1': partial(SingleValue, code=40),
    '$USERR2': partial(SingleValue, code=40),
    '$USERR3': partial(SingleValue, code=40),
    '$USERR4': partial(SingleValue, code=40),
    '$USERR5': partial(SingleValue, code=40),
    '$USRTIMER': partial(SingleValue, code=70),
    '$VERSIONGUID': partial(SingleValue, code=2),
    '$VISRETAIN': partial(SingleValue, code=70),
    '$WORLDVIEW': partial(SingleValue, code=70),
    '$XCLIPFRAME': partial(SingleValue, code=280),
    '$XEDIT': partial(SingleValue, code=290),
}
