Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.byondwave.app.travel360.Model
- import android.os.Parcel
- import android.os.Parcelable
- import android.text.TextUtils
- import androidx.room.PrimaryKey
- import com.google.gson.annotations.SerializedName
- import com.google.gson.annotations.Expose
- import com.google.gson.Gson
- import com.google.gson.JsonElement
- import com.google.gson.JsonParser
- import java.util.ArrayList
- data class TicketDetail(
- @SerializedName("id")
- @Expose
- var id = 0,
- @SerializedName("uuid")
- @Expose
- var uuid: String? = null,
- @SerializedName("product_id")
- @Expose
- var productId: String? = null,
- @SerializedName("vendor_id")
- @Expose
- var vendorId: String? = null,
- @SerializedName("vendor_name")
- @Expose
- var vendorName: String? = null,
- @SerializedName("main_category")
- @Expose
- var mainCategory: String? = null,
- @SerializedName("activity_type")
- @Expose
- var activityType: String? = null,
- @SerializedName("attraction_id")
- @Expose
- private var attractionId: String? = null,
- @SerializedName("attraction_name")
- @Expose
- var attractionName: String? = null,
- @SerializedName("product_name")
- @Expose
- var productName: String? = null,
- @SerializedName("product_description")
- @Expose
- var productDescription: String? = null,
- @SerializedName("product_status")
- @Expose
- var productStatus: String? = null,
- @SerializedName("website")
- @Expose
- var website: String? = null,
- @SerializedName("category_description")
- @Expose
- var categoryDescription: String? = null,
- @SerializedName("product_status_description")
- @Expose
- var productStatusDescription: String? = null,
- @SerializedName("keywords")
- @Expose
- var keywords: String? = null,
- @SerializedName("ticket_status_description")
- @Expose
- var ticketStatusDescription: String? = null,
- @PrimaryKey(autoGenerate = false)
- @SerializedName("ticket_id")
- @Expose
- var ticketId = 0
- @SerializedName("staging_id")
- @Expose
- var stagingId: String? = null,
- @SerializedName("sku")
- @Expose
- var sku: String? = null,
- @SerializedName("ticket_name")
- @Expose
- var ticketName: String? = null,
- @SerializedName("ticket_variant")
- @Expose
- var ticketVariant: String? = null,
- @SerializedName("ticket_variant_sf")
- @Expose
- var ticketVariantSf: String? = null,
- @SerializedName("purchase_limit_min")
- @Expose
- var purchaseLimitMin = 0,
- @SerializedName("purchase_limit_max")
- @Expose
- var purchaseLimitMax = 0,
- @SerializedName("age_from")
- @Expose
- var ageFrom = 0,
- @SerializedName("age_to")
- @Expose
- var ageTo = 0,
- @SerializedName("recommend_duration")
- @Expose
- var recommendDuration: String? = null,
- @SerializedName("is_validity_day_compulsory")
- @Expose
- var isValidityDayCompulsory: String? = null,
- @SerializedName("validity_days")
- @Expose
- var validityDays = 0,
- @SerializedName("is_fixed_period_compulsory")
- @Expose
- var isFixedPeriodCompulsory: String? = null,
- @SerializedName("redeem_start_date")
- @Expose
- var redeemStartDate: String? = null,
- @SerializedName("redeem_end_date")
- @Expose
- var redeemEndDate: String? = null,
- @SerializedName("is_visit_date_compulsory")
- @Expose
- var isVisitDateCompulsory: String? = null,
- @SerializedName("is_request_visit_date")
- @Expose
- var isRequestVisitDate: String? = null,
- @SerializedName("advance_booking_days")
- @Expose
- var advanceBookingDays = 0,
- @SerializedName("vendor_reference_id")
- @Expose
- var vendorReferenceId: String? = null,
- @SerializedName("ticket_status")
- @Expose
- var ticketStatus: String? = null,
- @SerializedName("question_id")
- @Expose
- var questionId = 0,
- @SerializedName("ticket_approve_date_time")
- @Expose
- var ticketApproveDateTime: String? = null,
- @SerializedName("ticket_description")
- @Expose
- var ticketDescription: String? = null,
- @SerializedName("start_date_time")
- @Expose
- var startDateTime: String? = null,
- @SerializedName("end_date_time")
- @Expose
- var endDateTime: String? = null,
- @SerializedName("is_capacity_compulsory")
- @Expose
- var isCapacityCompulsory: String? = null,
- @SerializedName("ticket_deactivate_date_time")
- @Expose
- var ticketDeactivateDateTime: String? = null,
- @SerializedName("term_id")
- @Expose
- var termId = 0,
- @SerializedName("tnc")
- @Expose
- var tnc: String? = null,
- @SerializedName("inclusion_list")
- @Expose
- var inclusionList: String? = null,
- @SerializedName("how_to_use")
- @Expose
- var howToUse: String? = null,
- @SerializedName("cancellation_note")
- @Expose
- var cancellationNote: String? = null,
- @SerializedName("question")
- @Expose
- var question: String? = null,
- @SerializedName("price_id")
- @Expose
- var priceId = 0,
- @SerializedName("ori_price")
- @Expose
- var oriPrice: String? = null,
- @SerializedName("selling_price")
- @Expose
- private var sellingPrice: String? = null,
- @SerializedName("selling_type")
- @Expose
- var sellingType = 0,
- @SerializedName("margin")
- @Expose
- var margin: String? = null,
- @SerializedName("settle_price")
- @Expose
- var settlePrice: String? = null,
- @SerializedName("currency_code")
- @Expose
- var currencyCode: String? = null,
- @SerializedName("discount_rate")
- @Expose
- var discountRate: String? = null,
- @SerializedName("effective_date")
- @Expose
- var effectiveDate: String? = null,
- @SerializedName("termination_date")
- @Expose
- var terminationDate: String? = null,
- @SerializedName("discount_price")
- @Expose
- var discountPrice: String? = null,
- @SerializedName("vendor_price")
- @Expose
- var vendorPrice: String? = null,
- @SerializedName("capacity_series")
- @Expose
- var capacitySeries: String? = null,
- @SerializedName("user_rating_reviews")
- @Expose
- var reviews: ArrayList<Review>? = null,
- @SerializedName("operation_hours")
- @Expose
- private var operationHours: JsonElement? = null,
- @SerializedName("hoursOfOperation")
- @Expose
- private var hoursOfOperation: JsonElement? = null,
- @SerializedName("ticket_group_name")
- @Expose
- var ticketGroupName: String? = null,
- @SerializedName("nearby_ticket")
- @Expose
- private var nearbyTickets: ArrayList<Ticket>? = null,
- @SerializedName("img_list")
- @Expose
- private var imgLists: JsonElement? = null,
- @SerializedName("no_of_booking")
- @Expose
- private var no_of_booking = 0,
- @SerializedName("rating")
- @Expose
- private var rating: String? = null,
- @SerializedName("review_count")
- @Expose
- private var review_count = 0,
- @SerializedName("actual_booking_number")
- @Expose
- private var actualBookingNumber = 0,
- @SerializedName("actual_review_rating")
- @Expose
- private var actualReviewRating: String? = null,
- @SerializedName("actual_review_number")
- @Expose
- private var actualReviewNumber = 0,
- @SerializedName("display_price")
- @Expose
- var display_price: String? = null,
- @SerializedName("currency")
- @Expose
- var currency: String? = null,
- @SerializedName("blackoutperiods")
- @Expose
- var blackoutPeriods: ArrayList<BlackoutPeriod>? = null,
- var quantity = 0,
- var urlImg: String? = null,
- var dateTime: Long = 0,
- var isSelected = false)
- fun getHoursOfOperation(): List<TicketOperatingHour> {
- val ticketOperatingHours = ArrayList<TicketOperatingHour>()
- if (null != hoursOfOperation) {
- if (hoursOfOperation!!.isJsonArray) {
- val arr = hoursOfOperation!!.asJsonArray
- val gson = Gson()
- for (i in 0 until arr.size()) {
- val ticketOperatingHour = gson.fromJson(arr[i], TicketOperatingHour::class.java)
- ticketOperatingHours.add(ticketOperatingHour)
- }
- }
- }
- return ticketOperatingHours
- }
- fun setHoursOfOperation(hoursOfOperation: JsonElement?) {
- this.hoursOfOperation = hoursOfOperation
- }
- fun getOperationHours(): List<TicketOperatingHour> {
- val ticketOperatingHours = ArrayList<TicketOperatingHour>()
- if (null != operationHours) {
- if (operationHours!!.isJsonArray) {
- val arr = operationHours!!.asJsonArray
- val gson = Gson()
- for (i in 0 until arr.size()) {
- val ticketOperatingHour = gson.fromJson(arr[i], TicketOperatingHour::class.java)
- ticketOperatingHours.add(ticketOperatingHour)
- }
- }
- }
- return ticketOperatingHours
- }
- fun setOperationHours(operationHours: JsonElement?) {
- this.operationHours = operationHours
- }
- fun getRating(): String? {
- return if (!TextUtils.isEmpty(actualReviewRating) && actualReviewRating!!.toDouble() > 0) actualReviewRating else rating
- }
- fun setRating(rating: String?) {
- this.rating = rating
- }
- fun getNo_of_booking(): Int {
- return if (actualBookingNumber > 0) actualBookingNumber else no_of_booking
- }
- fun setNo_of_booking(no_of_booking: Int) {
- this.no_of_booking = no_of_booking
- }
- fun getReview_count(): Int {
- return if (actualReviewNumber > 0) actualReviewNumber else review_count
- }
- fun setReview_count(review_count: Int) {
- this.review_count = review_count
- }
- fun getImgLists(): ArrayList<ImgList> {
- val imgs = ArrayList<ImgList>()
- val gson = Gson()
- if (null != imgLists) {
- if (imgLists!!.isJsonArray) {
- val arr = imgLists!!.asJsonArray
- for (i in 0 until arr.size()) {
- val imgList = gson.fromJson(arr[i], ImgList::class.java)
- imgs.add(imgList)
- }
- } else if (imgLists!!.isJsonObject) {
- val arr = imgLists!!.asJsonObject
- for ((_, value) in arr.entrySet()) {
- val img = gson.fromJson(value, ImgList::class.java)
- imgs.add(img)
- }
- }
- }
- return imgs
- }
- fun setImgLists(imgLists: JsonElement?) {
- this.imgLists = imgLists
- }
- fun getNearbyTickets(): ArrayList<Ticket>? {
- return nearbyTickets
- }
- fun setNearbyTickets(nearbyTickets: ArrayList<Ticket>?) {
- this.nearbyTickets = nearbyTickets
- }
- fun getAttractionId(): String? {
- return if (!TextUtils.isEmpty(attractionId)) attractionId else "0"
- }
- fun setAttractionId(attractionId: String?) {
- this.attractionId = attractionId
- }
- fun getSellingPrice(): String? {
- return if (!TextUtils.isEmpty(sellingPrice)) sellingPrice else "0"
- }
- fun setSellingPrice(sellingPrice: String?) {
- this.sellingPrice = sellingPrice
- }
- override fun describeContents(): Int {
- return 0
- }
- override fun writeToParcel(dest: Parcel, flags: Int) {
- dest.writeInt(id)
- dest.writeString(uuid)
- dest.writeString(productId)
- dest.writeString(vendorId)
- dest.writeString(vendorName)
- dest.writeString(mainCategory)
- dest.writeString(activityType)
- dest.writeString(attractionId)
- dest.writeString(attractionName)
- dest.writeString(productName)
- dest.writeString(productDescription)
- dest.writeString(productStatus)
- dest.writeString(website)
- dest.writeString(categoryDescription)
- dest.writeString(productStatusDescription)
- dest.writeString(keywords)
- dest.writeString(ticketStatusDescription)
- dest.writeInt(ticketId)
- dest.writeString(stagingId)
- dest.writeString(sku)
- dest.writeString(ticketName)
- dest.writeString(ticketVariant)
- dest.writeString(ticketVariantSf)
- dest.writeInt(purchaseLimitMin)
- dest.writeInt(purchaseLimitMax)
- dest.writeInt(ageFrom)
- dest.writeInt(ageTo)
- dest.writeString(recommendDuration)
- dest.writeString(isValidityDayCompulsory)
- dest.writeInt(validityDays)
- dest.writeString(isFixedPeriodCompulsory)
- dest.writeString(redeemStartDate)
- dest.writeString(redeemEndDate)
- dest.writeString(isVisitDateCompulsory)
- dest.writeString(isRequestVisitDate)
- dest.writeInt(advanceBookingDays)
- dest.writeString(vendorReferenceId)
- dest.writeString(ticketStatus)
- dest.writeInt(questionId)
- dest.writeString(ticketApproveDateTime)
- dest.writeString(ticketDescription)
- dest.writeString(startDateTime)
- dest.writeString(endDateTime)
- dest.writeString(isCapacityCompulsory)
- dest.writeString(ticketDeactivateDateTime)
- dest.writeInt(termId)
- dest.writeString(tnc)
- dest.writeString(inclusionList)
- dest.writeString(howToUse)
- dest.writeString(cancellationNote)
- dest.writeString(question)
- dest.writeInt(priceId)
- dest.writeString(oriPrice)
- dest.writeString(sellingPrice)
- dest.writeInt(sellingType)
- dest.writeString(margin)
- dest.writeString(settlePrice)
- dest.writeString(currencyCode)
- dest.writeString(discountRate)
- dest.writeString(effectiveDate)
- dest.writeString(terminationDate)
- dest.writeString(discountPrice)
- dest.writeString(vendorPrice)
- dest.writeString(capacitySeries)
- dest.writeTypedList(reviews)
- dest.writeString(operationHours.toString())
- dest.writeString(hoursOfOperation.toString())
- dest.writeString(ticketGroupName)
- dest.writeTypedList(nearbyTickets)
- dest.writeInt(no_of_booking)
- dest.writeString(rating)
- dest.writeInt(review_count)
- dest.writeString(display_price)
- dest.writeString(currency)
- dest.writeTypedList(blackoutPeriods)
- dest.writeInt(quantity)
- dest.writeString(urlImg)
- dest.writeLong(dateTime)
- dest.writeByte((if (isSelected) 1 else 0).toByte())
- }
- companion object {
- val CREATOR: Parcelable.Creator<TicketDetail> = object : Parcelable.Creator<TicketDetail> {
- override fun createFromParcel(`in`: Parcel): TicketDetail {
- return TicketDetail(`in`)
- }
- override fun newArray(size: Int): Array<TicketDetail?> {
- return arrayOfNulls(size)
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement