
from BaseDataMaintenance.model.ots.BaseModel import BaseModel

DOCUMENT_PRODUCT_DICT_INTERFACE_ID = "id" #uuid
DOCUMENT_PRODUCT_DICT_ORIGINAL_ID = "original_id"
DOCUMENT_PRODUCT_DICT_INTERFACE_NAME = "name"
DOCUMENT_PRODUCT_DICT_INTERFACE_ALIAS = "alias"
DOCUMENT_PRODUCT_DICT_INTERFACE_GRADE = "grade"
DOCUMENT_PRODUCT_DICT_INTERFACE_STATUS = "status" # 1-50 for todo 201-300 for done
DOCUMENT_PRODUCT_DICT_INTERFACE_PARENT_ID = "parent_id"
DOCUMENT_PRODUCT_DICT_INTERFACE_CREATE_TIME = "create_time"
DOCUMENT_PRODUCT_DICT_INTERFACE_UPDATE_TIME = "update_time"

DOCUMENT_PRODUCT_DICT_INTERFACE_STANDARD_ALIAS = "standard_alias"
DOCUMENT_PRODUCT_DICT_INTERFACE_STANDARD_ALIAS_SEPARATOR = "|"
DOCUMENT_PRODUCT_DICT_INTERFACE_ACTION = "action" #insert delete update

DOCUMENT_PRODUCT_DICT_INTERFACE_ACTION_BASE = "base"
DOCUMENT_PRODUCT_DICT_INTERFACE_ACTION_DELETE = "delete"
DOCUMENT_PRODUCT_DICT_INTERFACE_ACTION_UPDATE = "update"
DOCUMENT_PRODUCT_DICT_INTERFACE_ACTION_INSERT = "insert"

DOCUMENT_PRODUCT_DICT_INTERFACE_REMOVE_WORDS = "remove_words"
DOCUMENT_PRODUCT_DICT_INTERFACE_LEVEL = "level"

MAX_NAME_LENGTH = 300

Document_product_dict_interface_table_name = "document_product_dict_interface"



class Document_product_dict_interface(BaseModel):

    def __init__(self,_dict):
        BaseModel.__init__(self)
        for k,v in _dict.items():
            self.setValue(k,v,True)
        self.table_name = Document_product_dict_interface_table_name

    def getPrimary_keys(self):
        return ["id"]


from BaseDataMaintenance.common.documentFingerprint import getMD5
def get_document_product_dict_interface_base_id(name,grade):
    return "mdd5="+getMD5("%s-%d"%(name,grade))