import BaseEntity from "./BaseEntity";

export class SignalSourceEntity extends BaseEntity {
  name: string = "";
  window_type: string = "EwindowType::Normal";
  media_url: string = "";
  user_name: string = "";
  password: string = "";
  ext_data: string = "";
  group_uuid = "";
  rotation = 0;
  system_default: boolean = false;
  local_file_flag: boolean = false;
  note: string = "";

  public static copy(dest: SignalSourceEntity, src?: SignalSourceEntity) {
    if (!src) {
      src = new SignalSourceEntity();
    }

    dest.uuid = src.uuid;
    dest.base_note = src.base_note;
    dest.name = src.name;
    dest.window_type = src.window_type;
    dest.media_url = src.media_url;
    dest.user_name = src.user_name;
    dest.password = src.password;
    dest.ext_data = src.ext_data;
    dest.group_uuid = src.group_uuid;
    dest.system_default = src.system_default;
    dest.local_file_flag = src.local_file_flag;
    dest.note = src.note;
    dest.rotation = src.rotation;
  }
}

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

  constructor(
    uuid?: string,
    parent?: string,
    name?: string,
    is_group?: boolean,
    item_data?: any,
    children?: SignalSourceTreeItemEntity[]
  ) {
    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;
  }
}
