package com.flagship.abox.manager.domain

sealed interface DomainResult<out T> {
    data class Success<T>(val value: T) : DomainResult<T>

    data class Failure(val error: DomainError) : DomainResult<Nothing>
}

sealed interface DomainError {
    val externalCode: String?
    val detail: String?

    data class Authentication(
        override val externalCode: String? = null,
        override val detail: String? = null,
    ) : DomainError

    data class TokenInvalid(
        override val externalCode: String? = null,
        override val detail: String? = null,
    ) : DomainError

    data class Network(
        override val externalCode: String? = null,
        override val detail: String? = null,
    ) : DomainError

    data class DeviceNotFound(
        override val externalCode: String? = null,
        override val detail: String? = null,
    ) : DomainError

    data class DeviceOffline(
        override val externalCode: String? = null,
        override val detail: String? = null,
    ) : DomainError

    data class InvalidRequest(
        override val externalCode: String? = null,
        override val detail: String? = null,
    ) : DomainError

    data class OperationFailed(
        override val externalCode: String? = null,
        override val detail: String? = null,
    ) : DomainError

    data class NoData(
        override val externalCode: String? = null,
        override val detail: String? = null,
    ) : DomainError

    data class Unknown(
        override val externalCode: String? = null,
        override val detail: String? = null,
    ) : DomainError
}
