package ru.yandex.direct.web.entity.uac.service.history.parser

import org.springframework.stereotype.Component
import ru.yandex.direct.core.entity.uac.repository.ydb.model.UacYdbCampaign
import ru.yandex.direct.core.grut.model.GrutHistoryEventEntry
import ru.yandex.direct.web.entity.uac.model.history.GrutHistoryOutputCategory
import ru.yandex.direct.web.entity.uac.model.history.event.GrutAudienceConditionHistoryView

@Component
class AudienceConditionHistoryEventParser : BaseGrutCampaignHistoryEventParser() {
    override fun generateEvent(historyEntry: GrutHistoryEventEntry<UacYdbCampaign>): Any {
        return GrutAudienceConditionHistoryView(
            historyEntry.value.timeTarget,
            historyEntry.value.socdem,
            historyEntry.value.deviceTypes,
        )
    }

    override fun getOutputCategory(): GrutHistoryOutputCategory = GrutHistoryOutputCategory.CAMPAIGN_AUDIENCE_CONDITION
}
