import 'package:drift/drift.dart';
import 'package:im_app/data/local/drift/app_database.dart';
import 'package:im_app/data/repositories/base/base_mini_app_repository_impl.dart';
import 'package:im_app/domain/entities/mini_app.dart';

class FavoriteMiniAppRepositoryImpl
    extends
        BaseMiniAppRepositoryImpl<
          DriftFavoriteMiniApp,
          $FavoriteMiniAppsTable
        > {
  FavoriteMiniAppRepositoryImpl(super.storage);

  @override
  Insertable<DriftFavoriteMiniApp> toCompanion(MiniApp miniApp) =>
      FavoriteMiniAppsCompanion(
        id: Value(miniApp.id),
        name: Value(miniApp.name),
        openuid: Value(miniApp.openuid),
        devId: Value(miniApp.devId),
        icon: Value(miniApp.icon),
        iconGaussian: Value(miniApp.iconGaussian),
        downloadUrl: Value(miniApp.downloadUrl),
        description: Value(miniApp.description),
        version: Value(miniApp.version),
        typ: Value(miniApp.typ),
        flag: Value(miniApp.flag),
        reviewStatus: Value(miniApp.reviewStatus),
        favoriteAt: Value(miniApp.favoriteAt),
        isActive: Value(miniApp.isActive),
        createdAt: Value(miniApp.createdAt),
        updatedAt: Value(miniApp.updatedAt),
        deletedAt: Value(miniApp.deletedAt),
        score: Value(miniApp.score),
        channels: Value(miniApp.channels),
        devName: Value(miniApp.devName),
        pictureGaussian: Value(miniApp.pictureGaussian),
        picture: Value(miniApp.picture),
        commentNum: Value(miniApp.commentNum),
        lastLoginAt: Value(miniApp.lastLoginAt),
        screen: Value(miniApp.screen),
      );
}
