package com.todoroo.astrid.sync

import com.todoroo.astrid.dao.TaskDao
import com.todoroo.astrid.data.Task
import org.tasks.data.TagData
import org.tasks.data.TagDataDao
import org.tasks.injection.InjectingTestCase
import javax.inject.Inject

open class NewSyncTestCase : InjectingTestCase() {
    @Inject lateinit var taskDao: TaskDao
    @Inject lateinit var tagDataDao: TagDataDao

    suspend fun createTask(): Task {
        val task = Task()
        task.title = SYNC_TASK_TITLE
        task.priority = SYNC_TASK_IMPORTANCE
        taskDao.createNew(task)
        return task
    }

    suspend fun createTagData(): TagData {
        val tag = TagData()
        tag.name = "new tag"
        tagDataDao.createNew(tag)
        return tag
    }

    companion object {
        private const val SYNC_TASK_TITLE = "new title"
        private const val SYNC_TASK_IMPORTANCE = Task.Priority.MEDIUM
    }
}