package dev.inmo.tgbotapi.requests.send import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.content.VenueContent import dev.inmo.tgbotapi.types.venue.Venue import kotlinx.serialization.* private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() @Serializable data class SendVenue( @SerialName(chatIdField) override val chatId: ChatIdentifier, @SerialName(latitudeField) override val latitude: Double, @SerialName(longitudeField) override val longitude: Double, @SerialName(titleField) override val title: String, @SerialName(addressField) val address: String, @SerialName(foursquareIdField) val foursquareId: FoursquareId? = null, @SerialName(foursquareTypeField) val foursquareType: FoursquareType? = null, @SerialName(googlePlaceIdField) val googlePlaceId: GooglePlaceId? = null, @SerialName(googlePlaceTypeField) val googlePlaceType: GooglePlaceType? = null, @SerialName(messageThreadIdField) override val threadId: MessageThreadId? = chatId.threadId, @SerialName(businessConnectionIdField) override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(disableNotificationField) override val disableNotification: Boolean = false, @SerialName(protectContentField) override val protectContent: Boolean = false, @SerialName(replyParametersField) override val replyParameters: ReplyParameters? = null, @SerialName(replyMarkupField) override val replyMarkup: KeyboardMarkup? = null ) : SendMessageRequest>, PositionedSendMessageRequest>, TitledSendMessageRequest>, ReplyingMarkupSendMessageRequest> { constructor( chatId: ChatIdentifier, venue: Venue, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null ): this( chatId = chatId, latitude = venue.location.latitude, longitude = venue.location.longitude, title = venue.title, address = venue.address, foursquareId = venue.foursquareId, foursquareType = venue.foursquareType, googlePlaceId = venue.googlePlaceId, googlePlaceType = venue.googlePlaceType, threadId = threadId, disableNotification = disableNotification, protectContent = protectContent, replyParameters = replyParameters, replyMarkup = replyMarkup ) override fun method(): String = "sendVenue" override val resultDeserializer: DeserializationStrategy> get() = commonResultDeserializer override val requestSerializer: SerializationStrategy<*> get() = serializer() } fun Venue.toRequest( chatId: ChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, disableNotification: Boolean = false, protectContent: Boolean = false, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null ): SendVenue = SendVenue( chatId, this, threadId, businessConnectionId, disableNotification, protectContent, replyParameters, replyMarkup )