import { DataSource } from 'typeorm';
import {
  MessageEntity,
  UserEntity,
  RoomEntity,
  RoomChannelEntity,
  RoomMemberEntity,
  RoomRoleEntity,
  RoomUserRoleEntity,
  RoomChannelPermissionEntity,
  ReactionEntity,
  BanEntity,
  AttachmentEntity,
  MetaEntity,
  PluginDataEntity
} from '../../../entities';

export async function handleClearAllData(dataSource: DataSource): Promise<void> {
  await dataSource.getRepository(MessageEntity).clear();
  await dataSource.getRepository(UserEntity).clear();
  await dataSource.getRepository(RoomEntity).clear();
  await dataSource.getRepository(RoomChannelEntity).clear();
  await dataSource.getRepository(RoomMemberEntity).clear();
  await dataSource.getRepository(RoomRoleEntity).clear();
  await dataSource.getRepository(RoomUserRoleEntity).clear();
  await dataSource.getRepository(RoomChannelPermissionEntity).clear();
  await dataSource.getRepository(ReactionEntity).clear();
  await dataSource.getRepository(BanEntity).clear();
  await dataSource.getRepository(AttachmentEntity).clear();
  await dataSource.getRepository(MetaEntity).clear();
  await dataSource.getRepository(PluginDataEntity).clear();
}
