исправь ошибку C:\JavaProjects\B5\app\build\tmp\kapt3\stubs\debug\error\NonExistentClass.java:3: error: Dao class must be annotated with @Dao
public final class NonExistentClass { в коде package com.example.b5.data.dao

// data/dao/CardDao.kt

import androidx.lifecycle.LiveData
import androidx.room.*
import com.example.B5.data.model.Card

@Dao
interface CardDao {
    @Query("SELECT * FROM cards")
    fun getAllCards(): LiveData<List<Card>>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(card: Card)

    @Delete
    suspend fun delete(card: Card)
}
// data/database/AppDatabase.kt

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.example.B5.data.model.Card

@Database(entities = [Card::class], version = 1)
abstract class AppDatabase : RoomDatabase() {
    abstract fun cardDao(): CardDao

    companion object {
        @Volatile
        private var INSTANCE: AppDatabase? = null

        fun getDatabase(context: Context): AppDatabase {
            val tempInstance = INSTANCE
            if (tempInstance != null) {
                return tempInstance
            }
            synchronized(this) {
                val instance = Room.databaseBuilder(
                    context.applicationContext,
                    AppDatabase::class.java,
                    "app_database"
                ).build()
                INSTANCE = instance
                return instance
            }
        }
    }
}
package com.example.B5.data.model

import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "cards")
data class Card(
    @PrimaryKey val id: Int,
    val name: String,
    val cost: Int,
    val type: String, // Добавлено новое свойство type
    val abilities: String,
    val effects: String,
    val marks: String
)
package com.example.B5.data.repository

import androidx.lifecycle.LiveData
import com.example.B5.data.dao.CardDao // Исправлен импорт
import com.example.B5.data.model.Card
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

class CardRepository(private val cardDao: CardDao) {

    val allCards: LiveData<List<Card>> = cardDao.getAllCards()

    suspend fun insert(card: Card) {
        withContext(Dispatchers.IO) {
            cardDao.insert(card)
        }
    }

    suspend fun delete(card: Card) {
        withContext(Dispatchers.IO) {
            cardDao.delete(card)
        }
    }
}
// ui/view/CardListAdapter.kt
package com.example.B5.ui.view

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.B5.data.model.Card
import com.example.b5.R

class CardListAdapter : RecyclerView.Adapter<CardListAdapter.CardViewHolder>() {

    private var cards = emptyList<Card>()

    class CardViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
        val textView: TextView = itemView.findViewById(R.id.textView)
    }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CardViewHolder {
        val itemView = LayoutInflater.from(parent.context).inflate(R.layout.recyclerview_item, parent, false)
        return CardViewHolder(itemView)
    }

    override fun onBindViewHolder(holder: CardViewHolder, position: Int) {
        val current = cards[position]
        holder.textViewName.text = "Name: ${current.name}"
        holder.textViewCost.text = "Cost: ${current.cost}"
        holder.textViewType.text = "Type: ${current.type}" // Добавлено отображение типа карты
    }

    internal fun setCards(cards: List<Card>) {
        this.cards = cards
        notifyDataSetChanged()
    }

    override fun getItemCount() = cards.size
}package com.example.b5.ui.view

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.activity.viewModels
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.example.B5.data.model.Card
import com.example.B5.ui.view.CardListAdapter
import com.example.B5.ui.viewmodel.CardViewModel

import com.example.b5.R

class MainActivity : AppCompatActivity() {

    private val cardViewModel: CardViewModel by viewModels()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        setupRecyclerView()
    }

    private fun setupRecyclerView() {
        val recyclerView: RecyclerView = findViewById(R.id.recycler_view)
        val adapter = CardListAdapter()
        recyclerView.adapter = adapter

        // Добавляем LinearLayoutManager к RecyclerView
        recyclerView.layoutManager = LinearLayoutManager(this)

        cardViewModel.allCards.observe(this, Observer { cards ->
            cards?.let { adapter.setCards(it) }
        })
    }

    fun addCard(view: View) {
        val card = Card(id = 1, name = "John Sheridan", cost = 5, type = "character", abilities = "leadership:5", effects = "none", marks = "none")
        cardViewModel.insert(card)
        setupRecyclerView() // Обновление RecyclerView после добавления новой карты
    }
}
// ui/viewmodel/CardViewModel.kt
package com.example.B5.ui.viewmodel

import android.app.Application
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.viewModelScope
import com.example.B5.data.database.AppDatabase
import com.example.B5.data.model.Card
import com.example.B5.data.repository.CardRepository
import kotlinx.coroutines.launch

class CardViewModel(application: Application) : AndroidViewModel(application) {

    private val repository: CardRepository
    val allCards: LiveData<List<Card>>

    init {
        val cardDao = AppDatabase.getDatabase(application).cardDao()
        repository = CardRepository(cardDao)
        allCards = repository.allCards
    }

    fun insert(card: Card) = viewModelScope.launch {
        repository.insert(card)
    }

    fun delete(card: Card) = viewModelScope.launch {
        repository.delete(card)
    }
}