package com.quansu.heifengwuliu.activity

import com.quansu.heifengwuliu.R
import com.quansu.heifengwuliu.adapter.TodosAdapter
import com.quansu.heifengwuliu.base.MBRActivity
import com.quansu.heifengwuliu.databinding.ActivityTodosBinding
import com.quansu.heifengwuliu.utils.net.NetEngine
import com.quansu.heifengwuliu.vmodel.TodoListVModel
import com.ysnows.base.net.IResponse
import io.reactivex.Observable

class TodosActivity : MBRActivity<TodoListVModel, TodosAdapter, ActivityTodosBinding>() {
    override fun title(): String {
        return getStr(R.string.todo_list)!!
    }

    override fun initAdapter(): TodosAdapter = TodosAdapter(vm)

    override fun api(): Observable<out IResponse<*>> {
        return NetEngine.service.taskList("", vm?.repository()?.autoPage()!!)
    }

    override fun binding(): ActivityTodosBinding {
        return ActivityTodosBinding.inflate(layoutInflater)
    }

    override fun vmClass(): Class<TodoListVModel> {
        return TodoListVModel::class.java
    }
}