[
  {
    "apiName": "Invoice_Collection__c",
    "label": "Collection",
    "pluralLabel": "Collections",
    "tableType": "custom_object",
    "category": "crm",
    "sharingModel": "ControlledByParent",
    "enableHierarchySharing": false,
    "description": "Probe-converted object spec for Invoice_Collection__c",
    "fields": [
      {
        "apiName": "Name",
        "label": "Name",
        "type": "string",
        "isNameField": true
      },
      {
        "apiName": "Account_ID__c",
        "label": "Account ID",
        "type": "formula",
        "formula": "Account__r.Account_ID__c",
        "returnType": "string",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Account__c",
        "label": "Account",
        "type": "reference",
        "referenceTo": [
          "Account"
        ],
        "relationshipName": "Account__r",
        "childRelationshipName": "Payment_Details",
        "deleteConstraint": "SetNull"
      },
      {
        "apiName": "Accumulate_revenue_to_Org__c",
        "label": "Accumulate revenue to Org",
        "type": "formula",
        "formula": "Order__r.Accumulate_revenue_to_Org__c",
        "returnType": "string",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Action_Record__c",
        "label": "Action Record",
        "type": "richtextarea"
      },
      {
        "apiName": "Actual_Billing_Date__c",
        "label": "Actual Billing Date",
        "type": "date"
      },
      {
        "apiName": "Approval_Status__c",
        "label": "Approval Status",
        "type": "picklist",
        "options": [
          {
            "value": "Pending",
            "label": "Pending"
          },
          {
            "value": "In Process",
            "label": "In Process"
          },
          {
            "value": "Approved",
            "label": "Approved"
          },
          {
            "value": "Rejected",
            "label": "Rejected"
          }
        ]
      },
      {
        "apiName": "Cash_Collected__c",
        "label": "Cash Collected",
        "type": "double"
      },
      {
        "apiName": "CollectionsStatus__c",
        "label": "Collections  Status",
        "type": "picklist",
        "options": [
          {
            "value": "Uncollected",
            "label": "Uncollected"
          },
          {
            "value": "Received",
            "label": "Collected"
          },
          {
            "value": "Cancelled",
            "label": "Cancelled"
          }
        ]
      },
      {
        "apiName": "Collections_Amount_USD__c",
        "label": "Collections Amount (USD)",
        "type": "formula",
        "formula": "IF(Exchange_Rate_to_Use__c = 0,Collections_Amount__c / Exchange_Rate__c,Collections_Amount__c /Exchange_Rate_to_Use__c)",
        "returnType": "double",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Collections_Amount_USD_exc_tax__c",
        "label": "Collections Amount USD (exc.tax)",
        "type": "double"
      },
      {
        "apiName": "Collections_Amount__c",
        "label": "Collections Amount",
        "type": "currency"
      },
      {
        "apiName": "Collections_Amount_exc_tax__c",
        "label": "Collections Amount (exc.tax)",
        "type": "currency"
      },
      {
        "apiName": "Collections_Date__c",
        "label": "Collections Date",
        "type": "date"
      },
      {
        "apiName": "CurrencyIsoCode",
        "label": "Currency ISO Code",
        "type": "picklist",
        "default": "USD",
        "options": [
          {
            "label": "Chinese Yuan",
            "value": "CNY"
          },
          {
            "label": "Japanese Yen",
            "value": "JPY"
          },
          {
            "label": "Singapore Dollar",
            "value": "SGD"
          },
          {
            "label": "U.S. Dollar",
            "value": "USD"
          }
        ]
      },
      {
        "apiName": "Contact_Name__c",
        "label": "Contact Name",
        "type": "reference",
        "referenceTo": [
          "Contact"
        ],
        "relationshipName": "Contact_Name__r",
        "childRelationshipName": "Invoice_Collection",
        "deleteConstraint": "SetNull"
      },
      {
        "apiName": "Contract__c",
        "label": "Contract",
        "type": "reference",
        "referenceTo": [
          "Contract"
        ],
        "relationshipName": "Contract__r",
        "childRelationshipName": "Payment_Details",
        "deleteConstraint": "SetNull"
      },
      {
        "apiName": "DM__c",
        "label": "DM Owner",
        "type": "reference",
        "referenceTo": [
          "User"
        ],
        "relationshipName": "DM__r",
        "childRelationshipName": "Invoice_Collection",
        "deleteConstraint": "SetNull"
      },
      {
        "apiName": "Deal_Registration__c",
        "label": "Deal Registration",
        "type": "formula",
        "formula": "Order__r.Deal_Registration__c",
        "returnType": "string",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Email__c",
        "label": "Bill to Email",
        "type": "email"
      },
      {
        "apiName": "Estimated_Billing_Date__c",
        "label": "Estimated Billing Date",
        "type": "date"
      },
      {
        "apiName": "Exchange_Rate__c",
        "label": "Exchange Rate",
        "type": "formula",
        "formula": "IF(Exchange_Rate_to_Use__c = 0, Order__r.Exchange_Rate_to_Use__c, Exchange_Rate_to_Use__c)",
        "returnType": "double",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Exchange_Rate_to_Use__c",
        "label": "Exchange Rate to Use",
        "type": "double"
      },
      {
        "apiName": "Fiscal_Year__c",
        "label": "Fiscal Year",
        "type": "formula",
        "formula": "\"FY\"&RIGHT(text(YEAR( ADDMONTHS(Payable_Date__c,9))), 2)",
        "returnType": "string",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "From_Marketplace__c",
        "label": "From Marketplace",
        "type": "formula",
        "formula": "IF(Marketplace__c = \"gcp_account_provider\",\"GCP Marketplace\", IF(Marketplace__c = \"aws_account_provider\",\"AWS Marketplace\",IF(Marketplace__c = \"azure_account_provider\",\"Azure Marketplace\",\"N/A\")))",
        "returnType": "string",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Invoice_Number__c",
        "label": "Invoice Number",
        "type": "string"
      },
      {
        "apiName": "Invoice_Status__c",
        "label": "Invoice Status",
        "type": "picklist",
        "options": [
          {
            "value": "Not Issued",
            "label": "Not Issued"
          },
          {
            "value": "Issued",
            "label": "Issued"
          },
          {
            "value": "Invalidated",
            "label": "Invalidated"
          },
          {
            "value": "paid",
            "label": "paid"
          },
          {
            "value": "draft",
            "label": "draft"
          },
          {
            "value": "open",
            "label": "open"
          },
          {
            "value": "void",
            "label": "void"
          },
          {
            "value": "Not Applicable",
            "label": "Not Applicable"
          },
          {
            "value": "uncollectible",
            "label": "uncollectible"
          }
        ],
        "default": "Not Issued"
      },
      {
        "apiName": "IsCreatePDF__c",
        "label": "IsCreatePDF",
        "type": "boolean",
        "default": "0"
      },
      {
        "apiName": "Marketplace__c",
        "label": "Marketplace",
        "type": "string"
      },
      {
        "apiName": "Order_End_Date__c",
        "label": "Order End Date",
        "type": "formula",
        "formula": "Order__r.Overall_End_Date__c",
        "returnType": "date",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Order_Number__c",
        "label": "Order Number",
        "type": "formula",
        "formula": "HYPERLINK( Order__r.Id , Order__r.Name )",
        "returnType": "string",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Order__c",
        "label": "Order",
        "type": "masterdetail",
        "referenceTo": [
          "Order"
        ],
        "relationshipName": "Order__r",
        "childRelationshipName": "Payment_Details"
      },
      {
        "apiName": "PLG_BD_Pool__c",
        "label": "PLG BD Pool",
        "type": "boolean",
        "default": "0"
      },
      {
        "apiName": "Partner_Name__c",
        "label": "Partner Name",
        "type": "reference",
        "referenceTo": [
          "Account"
        ],
        "relationshipName": "Partner_Name__r",
        "childRelationshipName": "Collections",
        "deleteConstraint": "SetNull"
      },
      {
        "apiName": "Payable_Amount_USD2_exc_tax__c",
        "label": "Payable Amount USD (exc.tax)",
        "type": "double"
      },
      {
        "apiName": "Payable_Amount_USD__c",
        "label": "Payable Amount (USD)",
        "type": "formula",
        "formula": "IF(Exchange_Rate_to_Use__c = 0,Payable_Amount__c / Exchange_Rate__c,Payable_Amount__c /Exchange_Rate_to_Use__c)",
        "returnType": "double",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Payable_Amount_USD_exc_tax__c",
        "label": "Payable Amount USD (exc.tax)",
        "type": "currency"
      },
      {
        "apiName": "Payable_Amount__c",
        "label": "Payable Amount",
        "type": "currency"
      },
      {
        "apiName": "Payable_Date__c",
        "label": "Payable Date",
        "type": "date"
      },
      {
        "apiName": "Payment_Status__c",
        "label": "Payment Status",
        "type": "formula",
        "formula": "IF(TEXT(CollectionsStatus__c)='Received','Collected',\nIF(TEXT(CollectionsStatus__c)='Uncollected' && Payable_Date__c <= TODAY() ,'Due',\nIF(TEXT(CollectionsStatus__c)='Uncollected' && Payable_Date__c > TODAY() ,'Receivable','Receivable')))",
        "returnType": "string",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "PingCAP_Contracting_Entity__c",
        "label": "PingCAP Contracting Entity",
        "type": "string"
      },
      {
        "apiName": "Product_Family__c",
        "label": "Product Family",
        "type": "formula",
        "formula": "TEXT(Order__r.Product_Family__c)",
        "returnType": "string",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Region__c",
        "label": "Region",
        "type": "string"
      },
      {
        "apiName": "Remaining_Amount_USD__c",
        "label": "Remaining Amount (USD)",
        "type": "formula",
        "formula": "IF(Exchange_Rate_to_Use__c = 0,Remaining_Amount__c / Exchange_Rate__c,Remaining_Amount__c /Exchange_Rate_to_Use__c)",
        "returnType": "double",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Remaining_Amount__c",
        "label": "Remaining Amount",
        "type": "currency"
      },
      {
        "apiName": "Sales_Channel_Type__c",
        "label": "Sales Channel Type",
        "type": "formula",
        "formula": "Order__r.Sales_Channel_Type__c",
        "returnType": "string",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Stripe_Bill_ID__c",
        "label": "Stripe Bill ID",
        "type": "string",
        "unique": true
      },
      {
        "apiName": "Stripe_Invoice_PDF__c",
        "label": "Stripe Invoice PDF",
        "type": "url"
      },
      {
        "apiName": "Tax_Rate__c",
        "label": "Tax Rate",
        "type": "formula",
        "formula": "IF(Tax_Rate_to_use__c = 0,Order__r.Tax__c,Tax_Rate_to_use__c)",
        "returnType": "percent",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Tax_Rate_to_use__c",
        "label": "Tax Rate to use",
        "type": "percent"
      },
      {
        "apiName": "Uncollected_Amount_USD__c",
        "label": "Uncollected Amount(USD)",
        "type": "formula",
        "formula": "IF(TEXT( CollectionsStatus__c )!='Received', Payable_Amount_USD__c,0)",
        "returnType": "double",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      },
      {
        "apiName": "Uncollected_Amount__c",
        "label": "Uncollected Amount",
        "type": "formula",
        "formula": "IF(TEXT( CollectionsStatus__c )!='Received', Payable_Amount_USD__c,0)",
        "returnType": "currency",
        "formulaMode": "active",
        "createable": false,
        "updateable": false
      }
    ],
    "keyPrefix": "a0D"
  }
]
