#if UNITY_ANDROID
/*
* PubMatic Inc. ("PubMatic") CONFIDENTIAL
* Unpublished Copyright (c) 2006-2022 PubMatic, All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains the property of PubMatic. The intellectual and technical concepts contained
* herein are proprietary to PubMatic and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained
* from PubMatic.  Access to the source code contained herein is hereby forbidden to anyone except current PubMatic employees, managers or contractors who have executed
* Confidentiality and Non-disclosure agreements explicitly covering such access or to such other persons whom are directly authorized by PubMatic to access the source code and are subject to confidentiality and nondisclosure obligations with respect to the source code.
*
* The copyright notice above does not evidence any actual or intended publication or disclosure  of  this source code, which includes
* information that is confidential and/or proprietary, and is a trade secret, of  PubMatic.   ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC  PERFORMANCE,
* OR PUBLIC DISPLAY OF OR THROUGH USE  OF THIS  SOURCE CODE  WITHOUT  THE EXPRESS WRITTEN CONSENT OF PUBMATIC IS STRICTLY PROHIBITED, AND IN VIOLATION OF APPLICABLE
* LAWS AND INTERNATIONAL TREATIES.  THE RECEIPT OR POSSESSION OF  THIS SOURCE CODE AND/OR RELATED INFORMATION DOES NOT CONVEY OR IMPLY ANY RIGHTS
* TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT  MAY DESCRIBE, IN WHOLE OR IN PART.
*/
using System.Collections.Generic;
using UnityEngine;
using OpenWrapSDK.Common;
namespace OpenWrapSDK.Android
{
    /// 
    /// Android client for POBBid class, which provides the bid information. It will be common across all the ad formats in Android.
    /// 
    internal class POBBidClient : IPOBBid
    {
        #region Private Variables
        private readonly string Tag = "POBBidClient";
        private readonly AndroidJavaObject bidObject;
        #endregion
        /// 
        /// Constructor of POBBid Client
        /// 
        /// AndroidJavaObject of POBBid
        internal POBBidClient(AndroidJavaObject javaObject)
        {
            bidObject = javaObject;   
        }
        /// 
        ///  Returns creative id of bid
        /// 
        /// creative id
        public string GetCreativeId()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getCreativeId");
            }
            return null;
        }
        /// 
        /// Returns creative tag of bid
        /// 
        /// creative tag
        public string GetCreativeTag()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getCreative");
            }
            return null;
        }
        /// 
        /// Returns creative type of bid
        /// 
        /// creative type
        public string GetCreativeType()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getCreativeType");
            }
            return null;
        }
        /// 
        /// Returns deal id of bid
        /// 
        /// deal id
        public string GetDealId()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getDealId");
            }
            return null;
        }
        /// 
        /// Returns if bid has won or not
        /// 
        /// boolean vanlue if bid win
        public bool GetHasWon()
        {
            if (bidObject != null)
            {
                return bidObject.Call("hasWon");
            }
            return false;
        }
        /// 
        /// Returns height of creative of bid
        /// 
        /// height
        public int GetHeight()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getHeight");
            }
            return 0;
        }
        /// 
        /// Returns the name of the winning partner
        /// 
        /// Name of the winning partner
        public string GetPartner()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getPartnerName");
            }
            return null;
        }
        /// 
        /// Returns Net Price/bid value
        /// This method is updated to return net price from OW SDK v2.4.0.
        /// 
        /// net ecm/price
        public double GetPrice()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getPrice");
            }
            return 0;
        }
        /// 
        /// Returns the partner id of bid 
        /// 
        /// partner id
        public string GetPubmaticPartnerId()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getPartnerId");
            }
            return null;
        }
        /// 
        /// Returns winning  status of bid
        /// 
        /// status
        public int GetStatus()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getStatus");
            }
            return 0;
        }
        /// 
        /// Returns targeting info of bid
        /// 
        /// targeting info
        public Dictionary GetTargetingInfo()
        {
            if (bidObject != null)
            {
                AndroidJavaObject targetingInfo = bidObject.Call("getTargetingInfo");
                Dictionary targetingMap = POBAndroidUtils.ConvertJavaMapToDictionary(targetingInfo);
                return targetingMap;
            }
            return null;
        }
        /// 
        /// Returns width of bid creative
        /// 
        /// width
        public int GetWidth()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getWidth");
            }
            return 0;
        }
        /// 
        /// Returns if bid expired or not
        /// 
        /// bid expiry state
        public bool IsExpired()
        {
            if (bidObject != null)
            {
                POBLog.Info(Tag, POBLogStrings.ClientIsExpiredLog);
                return bidObject.Call("isExpired");
            }
            return false;
        }
        /// 
        /// Sets the current bid as winnging bid
        /// 
        /// bid win status
        public void SetHasWon(bool hasWon)
        {
            if (bidObject != null)
            {
                bidObject.Call("setHasWon", hasWon);
            }
        }
        /// 
        /// Return id of bid
        /// 
        /// bid id
        public string GetBidId()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getId");
            }
            return null;
        }
        /// 
        /// Returns gross price of bid 
        /// 
        /// gross price
        public double GetGrossPrice()
        {
            if (bidObject != null)
            {
                return bidObject.Call("getGrossPrice");
            }
            return 0;
        }
        public override string ToString()
        {
            if (bidObject != null)
            {
                return bidObject.Call("toString");
            }
            return null;
        }
    }
}
#endif