"""HWP 5.x 상수 정의"""

# HWP 파일 시그니처
HWP_SIGNATURE = b"HWP Document File"

# 스트림 이름
STREAM_FILE_HEADER = "FileHeader"
STREAM_DOC_INFO = "DocInfo"
STREAM_BODY_TEXT = "BodyText"
STREAM_PRV_TEXT = "PrvText"
STREAM_PRV_IMAGE = "PrvImage"
STREAM_BIN_DATA = "BinData"

# FileHeader 플래그 (offset 36, 4바이트)
FLAG_COMPRESSED = 0x01      # 압축 여부
FLAG_ENCRYPTED = 0x02       # 암호화 여부
FLAG_DISTRIBUTED = 0x04     # 배포용 문서
FLAG_SCRIPT = 0x08          # 스크립트 저장
FLAG_DRM = 0x10             # DRM 보안
FLAG_XML_TEMPLATE = 0x20    # XML 템플릿 저장
FLAG_HISTORY = 0x40         # 문서 이력 정보
FLAG_SIGNATURE = 0x80       # 전자 서명 정보

# HWP 레코드 태그 ID (BodyText 내)
HWPTAG_BEGIN = 0x0010

# 주요 태그
HWPTAG_DOCUMENT_PROPERTIES = 0x0010
HWPTAG_ID_MAPPINGS = 0x0011
HWPTAG_BIN_DATA = 0x0012
HWPTAG_FACE_NAME = 0x0013
HWPTAG_BORDER_FILL = 0x0014
HWPTAG_CHAR_SHAPE = 0x0015
HWPTAG_TAB_DEF = 0x0016
HWPTAG_NUMBERING = 0x0017
HWPTAG_BULLET = 0x0018
HWPTAG_PARA_SHAPE = 0x0019
HWPTAG_STYLE = 0x001A
HWPTAG_DOC_DATA = 0x001B
HWPTAG_DISTRIBUTE_DOC_DATA = 0x001C

# BodyText 섹션 내 태그 (0x0040 + offset)
HWPTAG_PARA_HEADER = 0x0042
HWPTAG_PARA_TEXT = 0x0043
HWPTAG_PARA_CHAR_SHAPE = 0x0044
HWPTAG_PARA_LINE_SEG = 0x0045
HWPTAG_PARA_RANGE_TAG = 0x0046
HWPTAG_CTRL_HEADER = 0x0047
HWPTAG_LIST_HEADER = 0x0048
HWPTAG_PAGE_DEF = 0x0049
HWPTAG_FOOTNOTE_SHAPE = 0x004A
HWPTAG_PAGE_BORDER_FILL = 0x004B
HWPTAG_SHAPE_COMPONENT = 0x004C
HWPTAG_TABLE = 0x004D
HWPTAG_SHAPE_COMPONENT_LINE = 0x004E
HWPTAG_SHAPE_COMPONENT_RECTANGLE = 0x004F
HWPTAG_SHAPE_COMPONENT_ELLIPSE = 0x0050
HWPTAG_SHAPE_COMPONENT_ARC = 0x0051
HWPTAG_SHAPE_COMPONENT_POLYGON = 0x0052
HWPTAG_SHAPE_COMPONENT_CURVE = 0x0053
HWPTAG_SHAPE_COMPONENT_OLE = 0x0054
HWPTAG_SHAPE_COMPONENT_PICTURE = 0x0055
HWPTAG_SHAPE_COMPONENT_CONTAINER = 0x0056
HWPTAG_CTRL_DATA = 0x0057
HWPTAG_EQEDIT = 0x0058

# 제어 문자 (텍스트 내)
CTRL_CHAR_LINE_BREAK = 0x000A       # 줄바꿈 (표 내)
CTRL_CHAR_PARA_BREAK = 0x000D       # 단락 구분
CTRL_CHAR_HARD_HYPHEN = 0x001E      # 하드 하이픈
CTRL_CHAR_SOFT_HYPHEN = 0x001F      # 소프트 하이픈

# 확장 제어 문자 (inline)
CTRL_INLINE_CHAR = 0x0001           # 필드 시작/끝
CTRL_INLINE_BOOKMARK = 0x0002       # 책갈피
CTRL_INLINE_SECTION_COL_DEF = 0x0003
CTRL_INLINE_FIELD_START = 0x0004
CTRL_INLINE_FIELD_END = 0x0005
CTRL_INLINE_TITLE_MARK = 0x0006
CTRL_INLINE_TAB = 0x0009
CTRL_INLINE_DRAWING = 0x000B
CTRL_INLINE_HEADER_FOOTER = 0x0015
CTRL_INLINE_FOOTNOTE = 0x0016
CTRL_INLINE_AUTO_NUMBER = 0x0017
CTRL_INLINE_PAGE_HIDE = 0x0018
CTRL_INLINE_PAGE_CTRL = 0x0019
CTRL_INLINE_BOOKMARK_END = 0x001A
CTRL_INLINE_HIDDEN_COMMENT = 0x001C

# 인코딩
DEFAULT_ENCODING = "utf-16-le"

# 제한
MAX_FILE_SIZE_MB = 50
TIMEOUT_SECONDS = 30
