package com.humand.demo.modules.IncomingCallMessagingService.common

import kotlinx.parcelize.Parcelize
import android.os.Parcelable
import androidx.annotation.Keep

object Constants {
    const val NOTIFICATION_ID = 1001
    const val CHANNEL_NAME = "humand_calls_channel"
    const val CALL_PAYLOAD = "CALL_PAYLOAD"
    const val OPENED_FROM_FULL_SCREEN_CALL_ACTIVITY = "OPENED_FROM_FULL_SCREEN_CALL_ACTIVITY"
    const val RN_EVENT_NAME = "CALL_ACCEPT_EVENT"
    const val CLOSE_FULL_SCREEN_ACTIVITY_EVENT = "CLOSE_FULL_SCREEN_ACTIVITY_EVENT"
    
    object Actions {
        const val DECLINE = "CALL_DECLINE"
    }

    enum class NotificationType {
        CALL_INITIALIZED_V2,
        CALL_MISSED_V2,
        CALL_ACCEPTED,
        CALL_REJECTED,
        CALL_ENDED,
        CALL_JOIN_REQUESTED;

        companion object {
            fun fromValue(value: String): NotificationType? =
                values().find { it.name == value }
        }
    }

    enum class AnswerStatus(val value: String) {
        ANSWERED("ANSWERED"),
        DECLINED("DECLINED");
    }

    object CallPayloadKeys {
        const val TYPE = "type"
        const val ID = "id"
        const val IS_GROUP = "isGroup"
        const val CALLER = "name"
        const val AVATAR_URL = "avatarUrl"
        const val PROVIDER_CALL_ID = "providerCallId"
        const val INITIALIZATION_CONFIG = "initializationConfig"
    }

    object API {
        const val KEYCHAIN_KEY = "KEYCHAIN_KEY"
        const val TOKENS = "TOKENS"
        const val ACCESS_TOKEN = "accessToken"
        const val REFRESH_TOKEN = "refreshToken"
        const val TOKEN_EXPIRED = "TOKEN_EXPIRED"

        object Headers {
            const val ORIGIN = "x-humand-origin"
            const val ORIGIN_ANDROID = "app"
        }
    }
}

@Keep
@Parcelize
data class CallPayload (
    val id: String,
    val type: Constants.NotificationType,
    val callerName: String,
    val isGroup: Boolean?,
    val providerCallId: String,
    val callerAvatar: String?,
    val initializationConfig:String?
) : Parcelable
