// 数据库存储的数据
interface OperationTreeDB {
    OperationTree: string; // JSON字符串，格式化之后是 OperationTree[] 列表
    ModelProcess?: string; // JSON字符串，格式化之后是 ModelProcess[] 列表
    ProcesslLabelList?: string; // JSON字符串，格式化之后是 ProcesslLabelList[] 列表
}

// 工艺数据机构
interface OperationTree {
    /** 主键ID */
    ID: string;
    /** 是否自动插入 */
    IsAutoInsert?: boolean | null;
    /** 工艺代码（主键） */
    CraftCode: string;
    /** 工艺类型代码 */
    CraftTypeCode: string;
    /** 品种 */
    Varieties: string;
    /** 工艺名称 */
    CraftName: string;
    /** 工艺设备类型代码 */
    CraftDeviceTypeCode: number;
    /** 项目代码（主键） */
    ProjectCode: string;
    /** 操作时间 */
    OperationTime: Date | string;
    /** 序列号 */
    SequenceNo?: number | null;
    /** 开始时间 */
    StartTime?: number | null;
    /** 持续时间 */
    KeepTime?: number | null;
    /** 模型代码 */
    ModelCode: string | null;
    /** 工艺播放数据 */
    CraftPlayData?: string | null;
    /** 关节工艺播放数据 */
    CraftPlayData_Joint?: string | null;
    /** 原始工艺播放数据 */
    CraftPlayData_Raw: string;
    /** 速率 */
    Rate: number | 0;
    /** 说明 */
    Explain?: string | null;
    /** 反向 */
    Reverse?: number | null;
    /** 当前播放 */
    CurrPlay?: boolean | null;
    /** 脚本文本 */
    ScriptText?: string | null;
    /** 是否存在脚本 */
    ExistScript?: boolean | null;
    /** 甘特图父节点 */
    GanttParent?: string | null;
    /** 父模型代码 */
    ModelCodeParent?: string | null;
    /** 父模型名称 */
    ModelNameParent?: string | null;
    /** 模型名称 */
    ModelName?: string | null;
    /** 标签ID */
    TagID?: string | null;
    /** 标签值 */
    TagValue?: string | null;
}

// 如果需要创建新对象的接口（所有字段可选）
interface OperationTreeCreate {
    ID?: string;
    IsAutoInsert?: boolean;
    CraftCode: string;
    CraftTypeCode?: string;
    Varieties?: string;
    CraftName?: string;
    CraftDeviceTypeCode?: number;
    ProjectCode: string;
    OperationTime?: Date | string;
    SequenceNo?: number;
    StartTime?: number;
    KeepTime?: number;
    ModelCode?: string;
    CraftPlayData?: string;
    CraftPlayData_Joint?: string;
    CraftPlayData_Raw?: string;
    Rate?: number;
    Explain?: string;
    Reverse?: number;
    CurrPlay?: boolean;
    ScriptText?: string;
    ExistScript?: boolean;
    GanttParent?: string;
    ModelCodeParent?: string;
    ModelNameParent?: string;
    ModelName?: string;
    TagID?: string;
    TagValue?: string;
}

interface OperationTreeExtra extends OperationTree {
    pId: string;
    id: string;
    parent: string;
    state: any;
    text: string;
    name: string;
    icon: string;
    checked: boolean;
    open: boolean;
}

interface JsTreeData_node_OperationTree {
    id: string;
    text: string;
    original: OperationTreeExtra;
    icon: string;
    children: string[]
    children_d: string[]
    parent: string
    parents: string[]
    state: {
        loaded: boolean;
        checked: boolean;
        opened: boolean;
        disabled: boolean;
        selected: boolean;
    };
}
interface JsTreeData_OperationTree_drop {
    node: JsTreeData_node_OperationTree;
    old_parent: string;
    parent: string;
    old_position: number;
    position: number;
}
interface OperationTree_SequenceNo {
    CraftTypeCode: string;
    CraftCode: string;
    SequenceNo: number;
}

export type {
    OperationTreeDB,
    OperationTree,
    OperationTreeCreate,
    OperationTreeExtra,
    OperationTree_SequenceNo,
    JsTreeData_node_OperationTree,
    JsTreeData_OperationTree_drop
}
