Initial commit2

This commit is contained in:
2025-12-13 13:11:27 +03:00
parent d0703ca008
commit 016a470680
72 changed files with 2540 additions and 157 deletions

View File

@@ -0,0 +1,12 @@
package com.novayaplaneta.domain.model
import java.time.LocalDateTime
data class ChatMessage(
val id: String,
val message: String,
val isFromAI: Boolean,
val timestamp: LocalDateTime,
val userId: String
)

View File

@@ -0,0 +1,14 @@
package com.novayaplaneta.domain.model
import java.time.LocalDateTime
data class Reward(
val id: String,
val title: String,
val description: String?,
val imageUrl: String?,
val points: Int,
val earnedAt: LocalDateTime? = null,
val userId: String
)

View File

@@ -0,0 +1,14 @@
package com.novayaplaneta.domain.model
import java.time.LocalDateTime
data class Schedule(
val id: String,
val title: String,
val description: String?,
val tasks: List<Task>,
val date: LocalDateTime,
val createdAt: LocalDateTime,
val userId: String
)

View File

@@ -0,0 +1,15 @@
package com.novayaplaneta.domain.model
import java.time.LocalDateTime
data class Task(
val id: String,
val title: String,
val description: String?,
val imageUrl: String?,
val completed: Boolean = false,
val scheduledTime: LocalDateTime?,
val duration: Int? = null, // in minutes
val scheduleId: String
)

View File

@@ -0,0 +1,16 @@
package com.novayaplaneta.domain.model
data class User(
val id: String,
val name: String,
val email: String,
val role: UserRole,
val token: String? = null
)
enum class UserRole {
CHILD,
PARENT,
TEACHER
}

View File

@@ -0,0 +1,11 @@
package com.novayaplaneta.domain.repository
import com.novayaplaneta.domain.model.ChatMessage
import kotlinx.coroutines.flow.Flow
interface AIRepository {
suspend fun sendMessage(userId: String, message: String): Result<String>
fun getChatHistory(userId: String): Flow<List<ChatMessage>>
suspend fun generateSchedule(userId: String, preferences: String): Result<String>
}

View File

@@ -0,0 +1,12 @@
package com.novayaplaneta.domain.repository
import com.novayaplaneta.domain.model.User
import kotlinx.coroutines.flow.Flow
interface AuthRepository {
suspend fun login(email: String, password: String): Result<User>
suspend fun logout()
fun getCurrentUser(): Flow<User?>
suspend fun saveUser(user: User)
}

View File

@@ -0,0 +1,14 @@
package com.novayaplaneta.domain.repository
import com.novayaplaneta.domain.model.Reward
import kotlinx.coroutines.flow.Flow
interface RewardRepository {
fun getRewards(userId: String): Flow<List<Reward>>
suspend fun getRewardById(id: String): Reward?
suspend fun createReward(reward: Reward)
suspend fun updateReward(reward: Reward)
suspend fun deleteReward(id: String)
suspend fun earnReward(userId: String, rewardId: String)
}

View File

@@ -0,0 +1,15 @@
package com.novayaplaneta.domain.repository
import com.novayaplaneta.domain.model.Schedule
import kotlinx.coroutines.flow.Flow
import java.time.LocalDateTime
interface ScheduleRepository {
fun getSchedules(userId: String): Flow<List<Schedule>>
suspend fun getScheduleById(id: String): Schedule?
suspend fun createSchedule(schedule: Schedule)
suspend fun updateSchedule(schedule: Schedule)
suspend fun deleteSchedule(id: String)
suspend fun syncSchedules(userId: String)
}

View File

@@ -0,0 +1,14 @@
package com.novayaplaneta.domain.repository
import com.novayaplaneta.domain.model.Task
import kotlinx.coroutines.flow.Flow
interface TaskRepository {
fun getTasks(scheduleId: String): Flow<List<Task>>
suspend fun getTaskById(id: String): Task?
suspend fun createTask(task: Task)
suspend fun updateTask(task: Task)
suspend fun deleteTask(id: String)
suspend fun completeTask(id: String)
}

View File

@@ -0,0 +1,13 @@
package com.novayaplaneta.domain.usecase
import com.novayaplaneta.domain.repository.TaskRepository
import javax.inject.Inject
class CompleteTaskUseCase @Inject constructor(
private val repository: TaskRepository
) {
suspend operator fun invoke(taskId: String) {
repository.completeTask(taskId)
}
}

View File

@@ -0,0 +1,14 @@
package com.novayaplaneta.domain.usecase
import com.novayaplaneta.domain.model.Schedule
import com.novayaplaneta.domain.repository.ScheduleRepository
import javax.inject.Inject
class CreateScheduleUseCase @Inject constructor(
private val repository: ScheduleRepository
) {
suspend operator fun invoke(schedule: Schedule) {
repository.createSchedule(schedule)
}
}

View File

@@ -0,0 +1,15 @@
package com.novayaplaneta.domain.usecase
import com.novayaplaneta.domain.model.Schedule
import com.novayaplaneta.domain.repository.ScheduleRepository
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject
class GetSchedulesUseCase @Inject constructor(
private val repository: ScheduleRepository
) {
operator fun invoke(userId: String): Flow<List<Schedule>> {
return repository.getSchedules(userId)
}
}

View File

@@ -0,0 +1,13 @@
package com.novayaplaneta.domain.usecase
import com.novayaplaneta.domain.repository.AIRepository
import javax.inject.Inject
class SendAIMessageUseCase @Inject constructor(
private val repository: AIRepository
) {
suspend operator fun invoke(userId: String, message: String): Result<String> {
return repository.sendMessage(userId, message)
}
}