1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.android.msdl.logging
18 
19 import com.google.android.msdl.data.model.MSDLToken
20 import com.google.android.msdl.domain.InteractionProperties
21 
22 /**
23  * A summary that represents a MSDL event. The event summarizes the delivery of playback from a
24  * [MSDLToken] along with optional [InteractionProperties].
25  *
26  * @param[tokenName] The name of the [MSDLToken] played.
27  * @param[properties] The text representation of [InteractionProperties] used to play the token.
28  * @param[timeStamp] A formatted time stamp for when the event occurred. The format for this time
29  *   stamp is [MSDLHistoryLogger.DATE_FORMAT]
30  */
31 data class MSDLEvent(val tokenName: String, val properties: String?, val timeStamp: String) {
32     constructor(
33         token: MSDLToken,
34         properties: InteractionProperties?,
35     ) : this(
36         token.name,
37         properties?.toString(),
38         MSDLHistoryLogger.DATE_FORMAT.format(System.currentTimeMillis()),
39     )
40 
toStringnull41     override fun toString(): String = "$timeStamp | token: $tokenName | properties: $properties"
42 }
43