import { StringKeyValueEntity } from "./StringKeyValueEntity";
import BaseEntity from "./BaseEntity";

export class ModeEntity extends BaseEntity {
  group_uuid: string = "";
  name: string = "";
  number: number = 0;
  grid_row = 2;
  grid_col = 2;
  joint_action_equipments: StringKeyValueEntity[] = [];
  public static copy(dest: ModeEntity, src?: ModeEntity) {
    if (!src) {
      src = new ModeEntity();
    }

    dest.uuid = src.uuid;
    dest.base_note = src.base_note;
    dest.name = src.name;
    dest.group_uuid = src.group_uuid;
    dest.number = src.number;
  }
}

export class ModeTreeItemEntity {
  uuid = "";
  parent = "";
  name = "";
  is_group = false;
  children: ModeTreeItemEntity[] = [];
  item_data: ModeEntity | null = null;

  constructor(
    uuid?: string,
    parent?: string,
    name?: string,
    is_group?: boolean,
    item_data?: any,
    children?: ModeTreeItemEntity[]
  ) {
    this.uuid = uuid ?? "";
    this.parent = parent ?? "";
    this.name = name ?? "";
    this.is_group = is_group ?? false;
    this.children = children ?? (Array.isArray(children) ? children : []);
    this.item_data = item_data;
  }
}
