Advertisement
vergepuppeter

TicketDetail Backup

May 19th, 2022
804
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.byondwave.app.travel360.Model
  2.  
  3. import android.os.Parcel
  4. import android.os.Parcelable
  5. import android.text.TextUtils
  6. import androidx.room.PrimaryKey
  7. import com.google.gson.annotations.SerializedName
  8. import com.google.gson.annotations.Expose
  9. import com.google.gson.Gson
  10. import com.google.gson.JsonElement
  11. import com.google.gson.JsonParser
  12. import java.util.ArrayList
  13.  
  14. data class TicketDetail(
  15.     @SerializedName("id")
  16.     @Expose
  17.     var id = 0,
  18.     @SerializedName("uuid")
  19.     @Expose
  20.     var uuid: String? = null,
  21.     @SerializedName("product_id")
  22.     @Expose
  23.     var productId: String? = null,
  24.     @SerializedName("vendor_id")
  25.     @Expose
  26.     var vendorId: String? = null,
  27.     @SerializedName("vendor_name")
  28.     @Expose
  29.     var vendorName: String? = null,
  30.     @SerializedName("main_category")
  31.     @Expose
  32.     var mainCategory: String? = null,
  33.     @SerializedName("activity_type")
  34.     @Expose
  35.     var activityType: String? = null,
  36.     @SerializedName("attraction_id")
  37.     @Expose
  38.     private var attractionId: String? = null,
  39.     @SerializedName("attraction_name")
  40.     @Expose
  41.     var attractionName: String? = null,
  42.     @SerializedName("product_name")
  43.     @Expose
  44.     var productName: String? = null,
  45.     @SerializedName("product_description")
  46.     @Expose
  47.     var productDescription: String? = null,
  48.     @SerializedName("product_status")
  49.     @Expose
  50.     var productStatus: String? = null,
  51.     @SerializedName("website")
  52.     @Expose
  53.     var website: String? = null,
  54.     @SerializedName("category_description")
  55.     @Expose
  56.     var categoryDescription: String? = null,
  57.     @SerializedName("product_status_description")
  58.     @Expose
  59.     var productStatusDescription: String? = null,
  60.     @SerializedName("keywords")
  61.     @Expose
  62.     var keywords: String? = null,
  63.     @SerializedName("ticket_status_description")
  64.     @Expose
  65.     var ticketStatusDescription: String? = null,
  66.     @PrimaryKey(autoGenerate = false)
  67.     @SerializedName("ticket_id")
  68.     @Expose
  69.     var ticketId = 0
  70.     @SerializedName("staging_id")
  71.     @Expose
  72.     var stagingId: String? = null,
  73.     @SerializedName("sku")
  74.     @Expose
  75.     var sku: String? = null,
  76.     @SerializedName("ticket_name")
  77.     @Expose
  78.     var ticketName: String? = null,
  79.     @SerializedName("ticket_variant")
  80.     @Expose
  81.     var ticketVariant: String? = null,
  82.     @SerializedName("ticket_variant_sf")
  83.     @Expose
  84.     var ticketVariantSf: String? = null,
  85.     @SerializedName("purchase_limit_min")
  86.     @Expose
  87.     var purchaseLimitMin = 0,
  88.     @SerializedName("purchase_limit_max")
  89.     @Expose
  90.     var purchaseLimitMax = 0,
  91.     @SerializedName("age_from")
  92.     @Expose
  93.     var ageFrom = 0,
  94.     @SerializedName("age_to")
  95.     @Expose
  96.     var ageTo = 0,
  97.     @SerializedName("recommend_duration")
  98.     @Expose
  99.     var recommendDuration: String? = null,
  100.     @SerializedName("is_validity_day_compulsory")
  101.     @Expose
  102.     var isValidityDayCompulsory: String? = null,
  103.  
  104.     @SerializedName("validity_days")
  105.     @Expose
  106.     var validityDays = 0,
  107.  
  108.     @SerializedName("is_fixed_period_compulsory")
  109.     @Expose
  110.     var isFixedPeriodCompulsory: String? = null,
  111.  
  112.     @SerializedName("redeem_start_date")
  113.     @Expose
  114.     var redeemStartDate: String? = null,
  115.  
  116.     @SerializedName("redeem_end_date")
  117.     @Expose
  118.     var redeemEndDate: String? = null,
  119.  
  120.     @SerializedName("is_visit_date_compulsory")
  121.     @Expose
  122.     var isVisitDateCompulsory: String? = null,
  123.  
  124.     @SerializedName("is_request_visit_date")
  125.     @Expose
  126.     var isRequestVisitDate: String? = null,
  127.  
  128.     @SerializedName("advance_booking_days")
  129.     @Expose
  130.     var advanceBookingDays = 0,
  131.  
  132.     @SerializedName("vendor_reference_id")
  133.     @Expose
  134.     var vendorReferenceId: String? = null,
  135.  
  136.     @SerializedName("ticket_status")
  137.     @Expose
  138.     var ticketStatus: String? = null,
  139.  
  140.     @SerializedName("question_id")
  141.     @Expose
  142.     var questionId = 0,
  143.  
  144.     @SerializedName("ticket_approve_date_time")
  145.     @Expose
  146.     var ticketApproveDateTime: String? = null,
  147.  
  148.     @SerializedName("ticket_description")
  149.     @Expose
  150.     var ticketDescription: String? = null,
  151.  
  152.     @SerializedName("start_date_time")
  153.     @Expose
  154.     var startDateTime: String? = null,
  155.  
  156.     @SerializedName("end_date_time")
  157.     @Expose
  158.     var endDateTime: String? = null,
  159.  
  160.     @SerializedName("is_capacity_compulsory")
  161.     @Expose
  162.     var isCapacityCompulsory: String? = null,
  163.  
  164.     @SerializedName("ticket_deactivate_date_time")
  165.     @Expose
  166.     var ticketDeactivateDateTime: String? = null,
  167.  
  168.     @SerializedName("term_id")
  169.     @Expose
  170.     var termId = 0,
  171.  
  172.     @SerializedName("tnc")
  173.     @Expose
  174.     var tnc: String? = null,
  175.  
  176.     @SerializedName("inclusion_list")
  177.     @Expose
  178.     var inclusionList: String? = null,
  179.  
  180.     @SerializedName("how_to_use")
  181.     @Expose
  182.     var howToUse: String? = null,
  183.  
  184.     @SerializedName("cancellation_note")
  185.     @Expose
  186.     var cancellationNote: String? = null,
  187.  
  188.     @SerializedName("question")
  189.     @Expose
  190.     var question: String? = null,
  191.  
  192.     @SerializedName("price_id")
  193.     @Expose
  194.     var priceId = 0,
  195.  
  196.     @SerializedName("ori_price")
  197.     @Expose
  198.     var oriPrice: String? = null,
  199.  
  200.     @SerializedName("selling_price")
  201.     @Expose
  202.     private var sellingPrice: String? = null,
  203.  
  204.     @SerializedName("selling_type")
  205.     @Expose
  206.     var sellingType = 0,
  207.  
  208.     @SerializedName("margin")
  209.     @Expose
  210.     var margin: String? = null,
  211.  
  212.     @SerializedName("settle_price")
  213.     @Expose
  214.     var settlePrice: String? = null,
  215.  
  216.     @SerializedName("currency_code")
  217.     @Expose
  218.     var currencyCode: String? = null,
  219.  
  220.     @SerializedName("discount_rate")
  221.     @Expose
  222.     var discountRate: String? = null,
  223.  
  224.     @SerializedName("effective_date")
  225.     @Expose
  226.     var effectiveDate: String? = null,
  227.  
  228.     @SerializedName("termination_date")
  229.     @Expose
  230.     var terminationDate: String? = null,
  231.  
  232.     @SerializedName("discount_price")
  233.     @Expose
  234.     var discountPrice: String? = null,
  235.  
  236.     @SerializedName("vendor_price")
  237.     @Expose
  238.     var vendorPrice: String? = null,
  239.  
  240.     @SerializedName("capacity_series")
  241.     @Expose
  242.     var capacitySeries: String? = null,
  243.  
  244.     @SerializedName("user_rating_reviews")
  245.     @Expose
  246.     var reviews: ArrayList<Review>? = null,
  247.  
  248.     @SerializedName("operation_hours")
  249.     @Expose
  250.     private var operationHours: JsonElement? = null,
  251.  
  252.     @SerializedName("hoursOfOperation")
  253.     @Expose
  254.     private var hoursOfOperation: JsonElement? = null,
  255.  
  256.     @SerializedName("ticket_group_name")
  257.     @Expose
  258.     var ticketGroupName: String? = null,
  259.  
  260.     @SerializedName("nearby_ticket")
  261.     @Expose
  262.     private var nearbyTickets: ArrayList<Ticket>? = null,
  263.  
  264.     @SerializedName("img_list")
  265.     @Expose
  266.     private var imgLists: JsonElement? = null,
  267.  
  268.     @SerializedName("no_of_booking")
  269.     @Expose
  270.     private var no_of_booking = 0,
  271.  
  272.     @SerializedName("rating")
  273.     @Expose
  274.     private var rating: String? = null,
  275.  
  276.     @SerializedName("review_count")
  277.     @Expose
  278.     private var review_count = 0,
  279.  
  280.     @SerializedName("actual_booking_number")
  281.     @Expose
  282.     private var actualBookingNumber = 0,
  283.  
  284.     @SerializedName("actual_review_rating")
  285.     @Expose
  286.     private var actualReviewRating: String? = null,
  287.  
  288.     @SerializedName("actual_review_number")
  289.     @Expose
  290.     private var actualReviewNumber = 0,
  291.  
  292.     @SerializedName("display_price")
  293.     @Expose
  294.     var display_price: String? = null,
  295.  
  296.     @SerializedName("currency")
  297.     @Expose
  298.     var currency: String? = null,
  299.  
  300.     @SerializedName("blackoutperiods")
  301.     @Expose
  302.     var blackoutPeriods: ArrayList<BlackoutPeriod>? = null,
  303.     var quantity = 0,
  304.     var urlImg: String? = null,
  305.     var dateTime: Long = 0,
  306.     var isSelected = false)
  307.  
  308.  
  309.  
  310.     fun getHoursOfOperation(): List<TicketOperatingHour> {
  311.         val ticketOperatingHours = ArrayList<TicketOperatingHour>()
  312.         if (null != hoursOfOperation) {
  313.             if (hoursOfOperation!!.isJsonArray) {
  314.                 val arr = hoursOfOperation!!.asJsonArray
  315.                 val gson = Gson()
  316.                 for (i in 0 until arr.size()) {
  317.                     val ticketOperatingHour = gson.fromJson(arr[i], TicketOperatingHour::class.java)
  318.                     ticketOperatingHours.add(ticketOperatingHour)
  319.                 }
  320.             }
  321.         }
  322.         return ticketOperatingHours
  323.     }
  324.  
  325.     fun setHoursOfOperation(hoursOfOperation: JsonElement?) {
  326.         this.hoursOfOperation = hoursOfOperation
  327.     }
  328.  
  329.     fun getOperationHours(): List<TicketOperatingHour> {
  330.         val ticketOperatingHours = ArrayList<TicketOperatingHour>()
  331.         if (null != operationHours) {
  332.             if (operationHours!!.isJsonArray) {
  333.                 val arr = operationHours!!.asJsonArray
  334.                 val gson = Gson()
  335.                 for (i in 0 until arr.size()) {
  336.                     val ticketOperatingHour = gson.fromJson(arr[i], TicketOperatingHour::class.java)
  337.                     ticketOperatingHours.add(ticketOperatingHour)
  338.                 }
  339.             }
  340.         }
  341.         return ticketOperatingHours
  342.     }
  343.  
  344.     fun setOperationHours(operationHours: JsonElement?) {
  345.         this.operationHours = operationHours
  346.     }
  347.  
  348.     fun getRating(): String? {
  349.         return if (!TextUtils.isEmpty(actualReviewRating) && actualReviewRating!!.toDouble() > 0) actualReviewRating else rating
  350.     }
  351.  
  352.     fun setRating(rating: String?) {
  353.         this.rating = rating
  354.     }
  355.  
  356.     fun getNo_of_booking(): Int {
  357.         return if (actualBookingNumber > 0) actualBookingNumber else no_of_booking
  358.     }
  359.  
  360.     fun setNo_of_booking(no_of_booking: Int) {
  361.         this.no_of_booking = no_of_booking
  362.     }
  363.  
  364.     fun getReview_count(): Int {
  365.         return if (actualReviewNumber > 0) actualReviewNumber else review_count
  366.     }
  367.  
  368.     fun setReview_count(review_count: Int) {
  369.         this.review_count = review_count
  370.     }
  371.  
  372.     fun getImgLists(): ArrayList<ImgList> {
  373.         val imgs = ArrayList<ImgList>()
  374.         val gson = Gson()
  375.         if (null != imgLists) {
  376.             if (imgLists!!.isJsonArray) {
  377.                 val arr = imgLists!!.asJsonArray
  378.                 for (i in 0 until arr.size()) {
  379.                     val imgList = gson.fromJson(arr[i], ImgList::class.java)
  380.                     imgs.add(imgList)
  381.                 }
  382.             } else if (imgLists!!.isJsonObject) {
  383.                 val arr = imgLists!!.asJsonObject
  384.                 for ((_, value) in arr.entrySet()) {
  385.                     val img = gson.fromJson(value, ImgList::class.java)
  386.                     imgs.add(img)
  387.                 }
  388.             }
  389.         }
  390.         return imgs
  391.     }
  392.  
  393.     fun setImgLists(imgLists: JsonElement?) {
  394.         this.imgLists = imgLists
  395.     }
  396.  
  397.     fun getNearbyTickets(): ArrayList<Ticket>? {
  398.         return nearbyTickets
  399.     }
  400.  
  401.     fun setNearbyTickets(nearbyTickets: ArrayList<Ticket>?) {
  402.         this.nearbyTickets = nearbyTickets
  403.     }
  404.  
  405.     fun getAttractionId(): String? {
  406.         return if (!TextUtils.isEmpty(attractionId)) attractionId else "0"
  407.     }
  408.  
  409.     fun setAttractionId(attractionId: String?) {
  410.         this.attractionId = attractionId
  411.     }
  412.  
  413.     fun getSellingPrice(): String? {
  414.         return if (!TextUtils.isEmpty(sellingPrice)) sellingPrice else "0"
  415.     }
  416.  
  417.     fun setSellingPrice(sellingPrice: String?) {
  418.         this.sellingPrice = sellingPrice
  419.     }
  420.  
  421.     override fun describeContents(): Int {
  422.         return 0
  423.     }
  424.  
  425.     override fun writeToParcel(dest: Parcel, flags: Int) {
  426.         dest.writeInt(id)
  427.         dest.writeString(uuid)
  428.         dest.writeString(productId)
  429.         dest.writeString(vendorId)
  430.         dest.writeString(vendorName)
  431.         dest.writeString(mainCategory)
  432.         dest.writeString(activityType)
  433.         dest.writeString(attractionId)
  434.         dest.writeString(attractionName)
  435.         dest.writeString(productName)
  436.         dest.writeString(productDescription)
  437.         dest.writeString(productStatus)
  438.         dest.writeString(website)
  439.         dest.writeString(categoryDescription)
  440.         dest.writeString(productStatusDescription)
  441.         dest.writeString(keywords)
  442.         dest.writeString(ticketStatusDescription)
  443.         dest.writeInt(ticketId)
  444.         dest.writeString(stagingId)
  445.         dest.writeString(sku)
  446.         dest.writeString(ticketName)
  447.         dest.writeString(ticketVariant)
  448.         dest.writeString(ticketVariantSf)
  449.         dest.writeInt(purchaseLimitMin)
  450.         dest.writeInt(purchaseLimitMax)
  451.         dest.writeInt(ageFrom)
  452.         dest.writeInt(ageTo)
  453.         dest.writeString(recommendDuration)
  454.         dest.writeString(isValidityDayCompulsory)
  455.         dest.writeInt(validityDays)
  456.         dest.writeString(isFixedPeriodCompulsory)
  457.         dest.writeString(redeemStartDate)
  458.         dest.writeString(redeemEndDate)
  459.         dest.writeString(isVisitDateCompulsory)
  460.         dest.writeString(isRequestVisitDate)
  461.         dest.writeInt(advanceBookingDays)
  462.         dest.writeString(vendorReferenceId)
  463.         dest.writeString(ticketStatus)
  464.         dest.writeInt(questionId)
  465.         dest.writeString(ticketApproveDateTime)
  466.         dest.writeString(ticketDescription)
  467.         dest.writeString(startDateTime)
  468.         dest.writeString(endDateTime)
  469.         dest.writeString(isCapacityCompulsory)
  470.         dest.writeString(ticketDeactivateDateTime)
  471.         dest.writeInt(termId)
  472.         dest.writeString(tnc)
  473.         dest.writeString(inclusionList)
  474.         dest.writeString(howToUse)
  475.         dest.writeString(cancellationNote)
  476.         dest.writeString(question)
  477.         dest.writeInt(priceId)
  478.         dest.writeString(oriPrice)
  479.         dest.writeString(sellingPrice)
  480.         dest.writeInt(sellingType)
  481.         dest.writeString(margin)
  482.         dest.writeString(settlePrice)
  483.         dest.writeString(currencyCode)
  484.         dest.writeString(discountRate)
  485.         dest.writeString(effectiveDate)
  486.         dest.writeString(terminationDate)
  487.         dest.writeString(discountPrice)
  488.         dest.writeString(vendorPrice)
  489.         dest.writeString(capacitySeries)
  490.         dest.writeTypedList(reviews)
  491.         dest.writeString(operationHours.toString())
  492.         dest.writeString(hoursOfOperation.toString())
  493.         dest.writeString(ticketGroupName)
  494.         dest.writeTypedList(nearbyTickets)
  495.         dest.writeInt(no_of_booking)
  496.         dest.writeString(rating)
  497.         dest.writeInt(review_count)
  498.         dest.writeString(display_price)
  499.         dest.writeString(currency)
  500.         dest.writeTypedList(blackoutPeriods)
  501.         dest.writeInt(quantity)
  502.         dest.writeString(urlImg)
  503.         dest.writeLong(dateTime)
  504.         dest.writeByte((if (isSelected) 1 else 0).toByte())
  505.     }
  506.  
  507.     companion object {
  508.         val CREATOR: Parcelable.Creator<TicketDetail> = object : Parcelable.Creator<TicketDetail> {
  509.             override fun createFromParcel(`in`: Parcel): TicketDetail {
  510.                 return TicketDetail(`in`)
  511.             }
  512.  
  513.             override fun newArray(size: Int): Array<TicketDetail?> {
  514.                 return arrayOfNulls(size)
  515.             }
  516.         }
  517.     }
  518. }
Advertisement
RAW Paste Data Copied
Advertisement