@isTest
public class TestDataUtility {
    public static void CreatePIPolicyConfiguration(){
        CreatePIPolicyConfigurations(null);
    }

    public static void CreatePIPolicyConfiguration(string sobject_name){
        CreatePIPolicyConfigurations(new string []{sobject_name});
    }

    public static void CreatePIPolicyConfigurations(List<String> sobjectTypes){
        String piJson = '[{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XWzKAAW"},"Sobject_Type__c":"SWO__c","New_URL__c":"/ssbgapi/swo/insert","Read_URL__c":"/ssbgapi/swo/query","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Undelete_URL__c":"/ssbgapi/swo/undelete","Id":"a0x0l000001XWzKAAW","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XTYDAA4"},"Sobject_Type__c":"User_FaultInfo__c","New_URL__c":"/ssbgapi/userfaultinfo/insert","Read_URL__c":"/ssbgapi/userfaultinfo/query","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Undelete_URL__c":"/ssbgapi/userfaultinfo/undelete","Id":"a0x0l000001XTYDAA4","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XVeVAAW"},"Sobject_Type__c":"Order","New_URL__c":"/ssbgapi/order/insert","Read_URL__c":"/ssbgapi/order/query","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Undelete_URL__c":"/ssbgapi/order/undelete","Id":"a0x0l000001XVeVAAW","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XX2TAAW"},"Sobject_Type__c":"loaner_application__c","New_URL__c":"/ssbgapi/loanerapplication/insert","Read_URL__c":"/ssbgapi/loanerapplication/query","Search_URL__c":"/ssbgapi/loanerapplication/search","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Undelete_URL__c":"/ssbgapi/loanerapplication/undelete","Id":"a0x0l000001XX2TAAW","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XozZAAS"},"Sobject_Type__c":"SBG027","New_URL__c":"/ssbgapi/sbg/027","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Id":"a0x0l000001XozZAAS","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XxDXAA0"},"Sobject_Type__c":"Mail","New_URL__c":"/ssbgapi/mail/sendEmail","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Id":"a0x0l000001XxDXAA0","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XWzeAAG"},"Sobject_Type__c":"Quotes__c","New_URL__c":"/ssbgapi/quotes/insert","Read_URL__c":"/ssbgapi/quotes/query","Search_URL__c":"/ssbgapi/quotes/search","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Undelete_URL__c":"/ssbgapi/quotes/undelete","Id":"a0x0l000001XWzeAAG","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XswlAAC"},"Sobject_Type__c":"Mail_Merge__c","New_URL__c":"/ssbgapi/mail/sendEmail","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Id":"a0x0l000001XswlAAC","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XB50AAG"},"Sobject_Type__c":"Opportunity","New_URL__c":"/ssbgapi/opportunity/insert","Read_URL__c":"/ssbgapi/opportunity/query","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Undelete_URL__c":"/ssbgapi/opportunity/undelete","Id":"a0x0l000001XB50AAG","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XxD8AAK"},"Sobject_Type__c":"Document","New_URL__c":"/api/file/upload","Read_URL__c":"/api/file/preview?key=","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Undelete_URL__c":"/api/file/download?key=","Id":"a0x0l000001XxD8AAK","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XlVuAAK"},"Sobject_Type__c":"Repair__c","New_URL__c":"/ssbgapi/repair/insert","Read_URL__c":"/ssbgapi/repair/query","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Undelete_URL__c":"/ssbgapi/repair/undelete","Id":"a0x0l000001XlVuAAK","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XlbnAAC"},"Sobject_Type__c":"loaner_user__c","New_URL__c":"/ssbgapi/loaneruser/insert","Read_URL__c":"/ssbgapi/loaneruser/query","Search_URL__c":"/ssbgapi/loaneruser/search","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Undelete_URL__c":"/ssbgapi/loaneruser/undelete","Id":"a0x0l000001XlbnAAC","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XlZNAA0"},"Sobject_Type__c":"SBG007","New_URL__c":"/ssbgapi/sbg/007","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Id":"a0x0l000001XlZNAA0","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XAcZAAW"},"Sobject_Type__c":"Contact","New_URL__c":"/ssbgapi/contact/insert","Read_URL__c":"/ssbgapi/contact/query","Search_URL__c":"/ssbgapi/contact/search","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Undelete_URL__c":"/ssbgapi/contact/undelete","Id":"a0x0l000001XAcZAAW","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Policy_Configuration__c","url":"/services/data/v54.0/sobjects/PI_Policy_Configuration__c/a0x0l000001XqaGAAS"},"Sobject_Type__c":"SBG001","New_URL__c":"/ssbgapi/sbg/001","TransactionURL__c":"https://sfpi-ssbg-test.olympuschina.com:8080/ssbgapi/tx/confirm","Id":"a0x0l000001XqaGAAS","CurrencyIsoCode":"CNY"}]';
        List<PI_Policy_Configuration__c> piList = (List<PI_Policy_Configuration__c>)JSON.deserialize(piJson,List<PI_Policy_Configuration__c>.class);
        List<PI_Policy_Configuration__c> insertPiList = new List<PI_Policy_Configuration__c>();

        for(PI_Policy_Configuration__c pi : piList){
            PI_Policy_Configuration__c ipi = new PI_Policy_Configuration__c();
            ipi.Delete_URL__c = pi.Delete_URL__c;
            ipi.Enable_Encrypt__c = pi.Enable_Encrypt__c;
            ipi.New_URL__c = pi.New_URL__c;
            ipi.Read_URL__c = pi.Read_URL__c;
            ipi.Search_URL__c = pi.Search_URL__c;
            ipi.Sobject_Type__c = pi.Sobject_Type__c;
            ipi.Undelete_URL__c = pi.Undelete_URL__c;
            ipi.Update_URL__c = pi.Update_URL__c;
            //ipi.View_Unified_Contact_URL__c = pi.View_Unified_Contact_URL__c;
            //ipi.Whether_Enable_Migration__c = pi.Whether_Enable_Migration__c;

            if(sobjectTypes==null || sobjectTypes.contains(pi.Sobject_Type__c)){
                insertPiList.add(ipi);
            }
            
        }
        insert insertPiList;
        Map<String,String> typeIdMap = new Map<String,String>();//key: type value: id
        for(PI_Policy_Configuration__c pi:insertPiList){
            typeIdMap.put(pi.Sobject_Type__c,pi.Id);
        }
        String pidJson = '[{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gUcLAAU"},"PI_Policy_Configuration_Name__c":"User_FaultInfo__c","PI_Policy_Configuration__c":"a0x0l000001XTYDAA4","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"INBOUND_EMAIL_ADDRESS__c","AWS_Field_API__c":"inboundEmailAddress","Id":"a0y0l000001gUcLAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gc42AAA"},"PI_Policy_Configuration_Name__c":"Quotes__c","PI_Policy_Configuration__c":"a0x0l000001XWzeAAG","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"CONTACT_EMAIL__c","AWS_Field_API__c":"contactEmail","Id":"a0y0l000001gc42AAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gpuDAAQ"},"PI_Policy_Configuration_Name__c":"Mail_Merge__c","PI_Policy_Configuration__c":"a0x0l000001XswlAAC","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"from","AWS_Field_API__c":"FROM__c","Id":"a0y0l000001gpuDAAQ","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gb86AAA"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Shipping_Address_Text__c","AWS_Field_API__c":"shippingAddressText","Id":"a0y0l000001gb86AAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbEsAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_N_CONTACT__c","AWS_Field_API__c":"pdfNContact","Id":"a0y0l000001gbEsAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbCIAAY"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"SpecialDeliveryContact_D__c","AWS_Field_API__c":"specialDeliveryContactD","Id":"a0y0l000001gbCIAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbDBAAY"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_N_NotifyParty__c","AWS_Field_API__c":"pdfNNotifyParty","Id":"a0y0l000001gbDBAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbJyAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_F_ContactPerson__c","AWS_Field_API__c":"pdfFContactPerson","Id":"a0y0l000001gbJyAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gcK5AAI"},"PI_Policy_Configuration_Name__c":"loaner_application__c","PI_Policy_Configuration__c":"a0x0l000001XX2TAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Loaner_receive_staff__c","AWS_Field_API__c":"loanerReceiveStaff","Id":"a0y0l000001gcK5AAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gcKPAAY"},"PI_Policy_Configuration_Name__c":"loaner_application__c","PI_Policy_Configuration__c":"a0x0l000001XX2TAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"return_Number__c","AWS_Field_API__c":"returnNumber","Id":"a0y0l000001gcKPAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001ggpjAAA"},"PI_Policy_Configuration_Name__c":"SWO__c","PI_Policy_Configuration__c":"a0x0l000001XWzKAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"CONTACT_NAME_HIDDEN__c","AWS_Field_API__c":"contactNameHidden","Id":"a0y0l000001ggpjAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSexAAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"OtherPhoneD__c","AWS_Field_API__c":"otherPhoneD","Id":"a0y0l000001gSexAAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSbZAAU"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"LastName","AWS_Field_API__c":"lastName","Id":"a0y0l000001gSbZAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSduAAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Title","AWS_Field_API__c":"title","Id":"a0y0l000001gSduAAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSeJAAU"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Address1D__c","AWS_Field_API__c":"address1D","Id":"a0y0l000001gSeJAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSeTAAU"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Address3D__c","AWS_Field_API__c":"address3D","Id":"a0y0l000001gSeTAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSdpAAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"TitleD__c","AWS_Field_API__c":"titleD","Id":"a0y0l000001gSdpAAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSe4AAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"EnglishAddress__c","AWS_Field_API__c":"englishAddress","Id":"a0y0l000001gSe4AAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSe5AAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Address1__c","AWS_Field_API__c":"address1","Id":"a0y0l000001gSe5AAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSeYAAU"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Fax","AWS_Field_API__c":"fax","Id":"a0y0l000001gSeYAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSf7AAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"OtherPhone","AWS_Field_API__c":"otherPhone","Id":"a0y0l000001gSf7AAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gc47AAA"},"PI_Policy_Configuration_Name__c":"Quotes__c","PI_Policy_Configuration__c":"a0x0l000001XWzeAAG","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"BILL_TO__c","AWS_Field_API__c":"billTo","Id":"a0y0l000001gc47AAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gUcQAAU"},"PI_Policy_Configuration_Name__c":"User_FaultInfo__c","PI_Policy_Configuration__c":"a0x0l000001XTYDAA4","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"UFPhone__c","AWS_Field_API__c":"ufPhone","Id":"a0y0l000001gUcQAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gc3nAAA"},"PI_Policy_Configuration_Name__c":"Quotes__c","PI_Policy_Configuration__c":"a0x0l000001XWzeAAG","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"CONTACT_PHONE__c","AWS_Field_API__c":"contactPhone","Id":"a0y0l000001gc3nAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gc43AAA"},"PI_Policy_Configuration_Name__c":"Quotes__c","PI_Policy_Configuration__c":"a0x0l000001XWzeAAG","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"SHIP_TO__c","AWS_Field_API__c":"shipTo","Id":"a0y0l000001gc43AAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbLEAAY"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_Sign_Title__c","AWS_Field_API__c":"pdfSignTitle","Id":"a0y0l000001gbLEAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbL4AAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"SpecialDeliveryAddress__c","AWS_Field_API__c":"specialDeliveryAddress","Id":"a0y0l000001gbL4AAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gb5lAAA"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"SpecialDeliveryPhone_D__c","AWS_Field_API__c":"specialDeliveryPhoneD","Id":"a0y0l000001gb5lAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbKpAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_C_FAX__c","AWS_Field_API__c":"pdfCFax","Id":"a0y0l000001gbKpAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbBcAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"SpecialDeliveryContact__c","AWS_Field_API__c":"specialDeliveryContact","Id":"a0y0l000001gbBcAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gc3xAAA"},"PI_Policy_Configuration_Name__c":"Quotes__c","PI_Policy_Configuration__c":"a0x0l000001XWzeAAG","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"CONTACT_FAX__c","AWS_Field_API__c":"contactFax","Id":"a0y0l000001gc3xAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbLJAAY"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_Sign_Name__c","AWS_Field_API__c":"pdfSignName","Id":"a0y0l000001gbLJAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbKkAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_C_TEL__c","AWS_Field_API__c":"pdfCTel","Id":"a0y0l000001gbKkAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbKuAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_C_Consignee__c","AWS_Field_API__c":"pdfCConsignee","Id":"a0y0l000001gbKuAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbHcAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_F_TEL__c","AWS_Field_API__c":"pdfFTe","Id":"a0y0l000001gbHcAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbKfAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_C_THECONSIGNE__c","AWS_Field_API__c":"pdfCTheconsigne","Id":"a0y0l000001gbKfAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gb5gAAA"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"SpecialDeliveryPhone__c","AWS_Field_API__c":"specialDeliveryPhone","Id":"a0y0l000001gb5gAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gb6FAAQ"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"SpecialDeliveryContactText__c","AWS_Field_API__c":"specialDeliveryContactText","Id":"a0y0l000001gb6FAAQ","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbI8AAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_F_FAX__c","AWS_Field_API__c":"pdfFFax","Id":"a0y0l000001gbI8AAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbDuAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_N_FAX__c","AWS_Field_API__c":"dfNFax","Id":"a0y0l000001gbDuAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbGoAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_S_TEL__c","AWS_Field_API__c":"pdfSTel","Id":"a0y0l000001gbGoAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbLOAAY"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_By_Tel__c","AWS_Field_API__c":"pdfByTel","Id":"a0y0l000001gbLOAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbKzAAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_C_CONTACT__c","AWS_Field_API__c":"pdfCContact","Id":"a0y0l000001gbKzAAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbL9AAI"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"SpecialDeliveryAddress_D__c","AWS_Field_API__c":"specialDeliveryAddressD","Id":"a0y0l000001gbL9AAI","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gbLTAAY"},"PI_Policy_Configuration_Name__c":"Order","PI_Policy_Configuration__c":"a0x0l000001XVeVAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PDF_By_Add__c","AWS_Field_API__c":"pdfByAdd","Id":"a0y0l000001gbLTAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gpotAAA"},"PI_Policy_Configuration_Name__c":"Mail_Merge__c","PI_Policy_Configuration__c":"a0x0l000001XswlAAC","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"allMemberName","AWS_Field_API__c":"ALL_MEMBER_NAME_Encrypted__c","Id":"a0y0l000001gpotAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gpouAAA"},"PI_Policy_Configuration_Name__c":"Mail_Merge__c","PI_Policy_Configuration__c":"a0x0l000001XswlAAC","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"allMember","AWS_Field_API__c":"ALL_MEMBER_Encrypted__c","Id":"a0y0l000001gpouAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gpovAAA"},"PI_Policy_Configuration_Name__c":"Mail_Merge__c","PI_Policy_Configuration__c":"a0x0l000001XswlAAC","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"bcc","AWS_Field_API__c":"BCC_Encrypted__c","Id":"a0y0l000001gpovAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gpowAAA"},"PI_Policy_Configuration_Name__c":"Mail_Merge__c","PI_Policy_Configuration__c":"a0x0l000001XswlAAC","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"cc","AWS_Field_API__c":"CC_Encrypted__c","Id":"a0y0l000001gpowAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gpoxAAA"},"PI_Policy_Configuration_Name__c":"Mail_Merge__c","PI_Policy_Configuration__c":"a0x0l000001XswlAAC","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"recipient","AWS_Field_API__c":"RECIPIENT_Encrypted__c","Id":"a0y0l000001gpoxAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gpoyAAA"},"PI_Policy_Configuration_Name__c":"Mail_Merge__c","PI_Policy_Configuration__c":"a0x0l000001XswlAAC","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"bccName","AWS_Field_API__c":"bccName__c","Id":"a0y0l000001gpoyAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gpozAAA"},"PI_Policy_Configuration_Name__c":"Mail_Merge__c","PI_Policy_Configuration__c":"a0x0l000001XswlAAC","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"ccName","AWS_Field_API__c":"ccName__c","Id":"a0y0l000001gpozAAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gpp0AAA"},"PI_Policy_Configuration_Name__c":"Mail_Merge__c","PI_Policy_Configuration__c":"a0x0l000001XswlAAC","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"toName","AWS_Field_API__c":"toName__c","Id":"a0y0l000001gpp0AAA","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gT5TAAU"},"PI_Policy_Configuration_Name__c":"Opportunity","PI_Policy_Configuration__c":"a0x0l000001XB50AAG","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Dealer_Sales_Staff_Name_D__c","AWS_Field_API__c":"dealerSalesStaffNameD","Id":"a0y0l000001gT5TAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gT5JAAU"},"PI_Policy_Configuration_Name__c":"Opportunity","PI_Policy_Configuration__c":"a0x0l000001XB50AAG","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Dealer_Service_D__c","AWS_Field_API__c":"dealerServiceD","Id":"a0y0l000001gT5JAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gcKKAAY"},"PI_Policy_Configuration_Name__c":"loaner_application__c","PI_Policy_Configuration__c":"a0x0l000001XX2TAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Return_Trake_Staff__c","AWS_Field_API__c":"returnTrakeStaff","Id":"a0y0l000001gcKKAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gcKZAAY"},"PI_Policy_Configuration_Name__c":"loaner_application__c","PI_Policy_Configuration__c":"a0x0l000001XX2TAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Loaner_Ser__c","AWS_Field_API__c":"loanerSer","Id":"a0y0l000001gcKZAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gcKAAAY"},"PI_Policy_Configuration_Name__c":"loaner_application__c","PI_Policy_Configuration__c":"a0x0l000001XX2TAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"direct_shippment_address__c","AWS_Field_API__c":"directShippmentAddress","Id":"a0y0l000001gcKAAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gcKFAAY"},"PI_Policy_Configuration_Name__c":"loaner_application__c","PI_Policy_Configuration__c":"a0x0l000001XX2TAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Loaner_receive_staff_phone__c","AWS_Field_API__c":"loanerReceiveStaffPhone","Id":"a0y0l000001gcKFAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gcKUAAY"},"PI_Policy_Configuration_Name__c":"loaner_application__c","PI_Policy_Configuration__c":"a0x0l000001XX2TAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Post_Code__c","AWS_Field_API__c":"postCode","Id":"a0y0l000001gcKUAAY","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gT5OAAU"},"PI_Policy_Configuration_Name__c":"Opportunity","PI_Policy_Configuration__c":"a0x0l000001XB50AAG","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"DealerService__c","AWS_Field_API__c":"dealerService","Id":"a0y0l000001gT5OAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gT5YAAU"},"PI_Policy_Configuration_Name__c":"Opportunity","PI_Policy_Configuration__c":"a0x0l000001XB50AAG","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"DealerSalesStaffName__c","AWS_Field_API__c":"dealerSalesStaffName","Id":"a0y0l000001gT5YAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gcrBAAQ"},"PI_Policy_Configuration_Name__c":"loaner_user__c","PI_Policy_Configuration__c":"a0x0l000001XlbnAAC","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"ContactNumber__c","AWS_Field_API__c":"contactNumber","Id":"a0y0l000001gcrBAAQ","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSeiAAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"EmailD__c","AWS_Field_API__c":"emailD","Id":"a0y0l000001gSeiAAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSbjAAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PostcodeD__c","AWS_Field_API__c":"postcodeD","Id":"a0y0l000001gSbjAAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSeEAAU"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Address3__c","AWS_Field_API__c":"address3","Id":"a0y0l000001gSeEAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSeOAAU"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Address2D__c","AWS_Field_API__c":"address2D","Id":"a0y0l000001gSeOAAU","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSesAAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"MobilePhoneD__c","AWS_Field_API__c":"mobilePhoneD","Id":"a0y0l000001gSesAAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSenAAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Email","AWS_Field_API__c":"email","Id":"a0y0l000001gSenAAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSbeAAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Postcode__c","AWS_Field_API__c":"postcode","Id":"a0y0l000001gSbeAAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSe9AAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Address2__c","AWS_Field_API__c":"address2","Id":"a0y0l000001gSe9AAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSf2AAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"PhoneD__c","AWS_Field_API__c":"phoneD","Id":"a0y0l000001gSf2AAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSf3AAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"MobilePhone","AWS_Field_API__c":"mobilePhone","Id":"a0y0l000001gSf3AAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSdzAAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"ContactEnglishName__c","AWS_Field_API__c":"contactEnglishName","Id":"a0y0l000001gSdzAAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSedAAE"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"FaxD__c","AWS_Field_API__c":"faxD","Id":"a0y0l000001gSedAAE","CurrencyIsoCode":"CNY"},{"attributes":{"type":"PI_Field_Policy_Detail__c","url":"/services/data/v54.0/sobjects/PI_Field_Policy_Detail__c/a0y0l000001gSfCAAU"},"PI_Policy_Configuration_Name__c":"Contact","PI_Policy_Configuration__c":"a0x0l000001XAcZAAW","Enable_Encrypt__c":true,"Field_Type__c":"String","SF_Field_API_Name__c":"Phone","AWS_Field_API__c":"phone","Id":"a0y0l000001gSfCAAU","CurrencyIsoCode":"CNY"}]';
        List<PI_Field_Policy_Detail__c> pidList = (List<PI_Field_Policy_Detail__c>)JSON.deserialize(pidJson,List<PI_Field_Policy_Detail__c>.class);
        List<PI_Field_Policy_Detail__c> insertPidList = new List<PI_Field_Policy_Detail__c>();
        for(PI_Field_Policy_Detail__c pid:pidList){
            if (!typeIdMap.containsKey((pid.PI_Policy_Configuration_Name__c))){
                continue;
            }

            PI_Field_Policy_Detail__c ipid = new PI_Field_Policy_Detail__c();
            ipid.Enable_Encrypt__c = pid.Enable_Encrypt__c;
            ipid.Field_Type__c = pid.Field_Type__c;
            //ipid.Order_Number__c = pid.Order_Number__c;
            ipid.PI_Policy_Configuration__c = typeIdMap.get(pid.PI_Policy_Configuration_Name__c);
            ipid.SF_Field_API_Name__c = pid.SF_Field_API_Name__c;
            ipid.AWS_Field_API__c = pid.AWS_Field_API__c;
            ipid.SF_Field_Encrypted_API__c = pid.SF_Field_Encrypted_API__c;
            ipid.AWS_Encrypted_Field_API__c = pid.AWS_Encrypted_Field_API__c;
            insertPidList.add(ipid);
        }
        insert insertPidList;
    }
    //create sample user
    public static List<User> CreateUsers(Integer num){
        Map<Id,Profile> profileList = new Map<Id, Profile>([SELECT Id, Name FROM Profile]) ;
        Map<String, Profile> profileMap = new Map<String, Profile>();
        Profile p = [select Id from Profile where Name = 'System Administrator'];
        for(Profile profileTemp : profileList.values()){
            profileMap.put(profileTemp.Name, profileTemp);
        }
        
        List<User> userList=new List<User>();
         for(Integer i = 0 ;i<num;i++){
         	User u = new User( Alias = 'test',
			                     Email = 'testuser'+i+'@olympus.com',
			                     Emailencodingkey = 'UTF-8', 
			                     Lastname = 'TestUser'+i, 
			                     Languagelocalekey = 'zh_CN',
			        			 Localesidkey = 'zh_CN', 
			        			 Profileid = p.id, 
			        			 Country = 'China',
			        			 IsActive = true,
			        			 Timezonesidkey = 'America/Sao_Paulo', 
			                     Username = 'testuser'+i+'@olympus.com'
                                 //,Job_Category__c = '销售服务'
			);
            userList.add(u);
         }
        insert userList;
        //根据简档名取对应userList  Map<String,List<User>>
        // Map<String, List<User>> sampleUserMap = new Map<String, List<User>>();
        // for(User userTemp : userList){
        //     String profileName = profileList.get(userTemp.Profileid).Name ;
        //     if(sampleUserMap.containsKey(profileName)) {
        //         sampleUserMap.get(profileName).add(userTemp);
        //     }else{
        //         List<User> userTempList = new List<User>();
        //         userTempList.add(userTemp);
        //         sampleUserMap.put(profileName, userTempList);
        //     }
        // }
        // return sampleUserMap;
        //直接返回userlist
        return userList;
    }
    public static List<Account> CreateAccounts(Integer num){
    	List<RecordType> rectIE = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE'];
        
        List<Account> acclist = new List<Account>();
        String[] ieSubUse = new String[] {'LED','FPD','半导体','电子部品','电子类_其他','金属','汽车','石油地质','五金模具','重工设备','材料类_其他'};
        for (Integer i = 0; i < num; i++) {
            Account acc1 = new Account();
            acc1.Name = 'TestAccount'+String.valueOf(Datetime.now().minute())+String.valueOf(datetime.now().second())+i;
            acc1.FacilityName__c = 'Account';
            acc1.DivisionName__c = ieSubUse[i];
            acc1.RecordTypeId = rectIE[0].Id;
            acc1.ProductSegment__c = 'IE';
            acc1.Sub_UseD__c = ieSubUse[i];
            acc1.Sub_Use__c = ieSubUse[i];
            acc1.PostCode__c = '000000';
            acclist.add(acc1);
        }
        insert acclist;
        return acclist;
    }
    public static List<Contact> CreateContacts(Integer num){
    	List<Account> accList = new List<Account>();
        accList = [Select id From Account];
        if(accList.size()==0){
            accList = CreateAccounts(1);
        }
    	List<Contact> conList = new List<Contact>();
    	for(Integer i=0;i<num;i++){
    		Contact con = new Contact();
    		con.AccountId = accList[0].Id;
	        con.FirstName = '責任者';
	        con.LastName = 'test'+i+'医院';
	        //con.Strategic_dept_Class__c = accList[0].Id;
	        conList.add(con);
    	}
    	insert conList;
    	return conList;
    }
    public static List<Opportunity> CreateOpportunitys(Integer num){
        //new Contact
        Account acc = new Account();
        if([SELECT Id,Name FROM Account LIMIT 1].size()>0){
            acc = [SELECT Id,Name FROM Account LIMIT 1];
        }else{
            acc = CreateAccounts(1)[0];
        }
    	List<Opportunity> oppList = new List<Opportunity>();
        // List<RecordType> rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity'];
    	for(Integer i=0;i<num;i++){
    		Opportunity opp = new Opportunity(
            Name = 'test opp',
            AccountId = acc.Id,
            RecordTypeId = System.Label.SSBD_Replacement,
            OwnerId = UserInfo.getUserId(),
            StageName = 'Phase3',//Prospect Created
            CurrencyIsoCode = 'CNY',
            ProductSegment__c = 'IE',
            TradeType__c = 'Taxation',
            // ForeignTradeCompany_D__c = acc.Id,
            CloseDate = Date.today(),
            NewInquiryDate__c = Date.today().addDays(-2),
            ExpectedOrderDate__c = Date.today().addDays(2),
            SalesChannel__c = 'direct'
        );
    		oppList.add(opp);
    	}
    	insert oppList;
    	return oppList;
    }
    public static List<Task> CreateTasks(Integer num){
    	List<Task> taList = new List<Task>();
    	Account acc = CreateAccounts(1)[0];
    	Opportunity opp = CreateOpportunitys(1)[0];
    	for(Integer i=0;i<num;i++){
    		Task ta = new Task();
     		//ta.account__c = acc.id;
			// ta.name = 'testTask'+i;
			// ta.taskStatus__c = '01 分配';
			// ta.assignee__c = UserInfo.getUserId();
	        //ta.recordtypeId = Schema.SObjectType.task__c.getRecordTypeInfosByDeveloperName().get('OPD').getRecordTypeId();
	        //ta.distributionCount__c = 1;
	        //ta.taskDifferent__c = '被动任务';
	        //ta.OpportunityId__c = opp.Id;
     		//taList.add(ta);
    	}
    	insert taList;
    	return taList;
    }
    public static List<Asset> CreateAssets(Integer num){
    	// 省
        /*Address_Level__c al = new Address_Level__c();
        al.Name = '東京';
        al.Level1_Code__c = 'CN-99';
        al.Level1_Sys_No__c = '999999';
        insert al;
        // 市
        Address_Level2__c al2 = new Address_Level2__c();
        al2.Level1_Code__c = 'CN-99';
        al2.Level1_Sys_No__c = '999999';
        al2.Level1_Name__c = '東京';
        al2.Name = '渋谷区';
        al2.Level2_Code__c = 'CN-9999';
        al2.Level2_Sys_No__c = '9999999';
        al2.Address_Level__c = al.id;
        insert al2;*/

        // 病院を作る
        //ControllerUtil.EscapeNFM001Trigger = true;
        //StaticParameter.EscapeNFM001Trigger = true;
        //StaticParameter.EscapeAccountTrigger = true;
        //StaticParameter.EscapeNFM001AgencyContractTrigger = true;

        Account hospital = new Account();
        hospital.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'HP'].id;
        System.debug('病院完了!');
        hospital.Name = 'test hospital';
        //hospital.Is_Active__c = '有効';
        //hospital.Attribute_Type__c = '卫生部';
        //hospital.Speciality_Type__c = '综合医院';
        //hospital.Grade__c = '一级';
        //hospital.OCM_Category__c = 'SLTV';
        //hospital.Is_Medical__c = '医疗机构';
        //hospital.State_Master__c = al.id;
        //hospital.City_Master__c = al2.id;
        //hospital.Town__c = '东京';
        insert hospital;
        System.debug('病院 insert 完了!');

        // 戦略科室を得る
        Account strategicDep = new Account();
        strategicDep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_Class_OTH'].id;
        strategicDep.Name = 'Olympus社内 其他';
        //strategicDep.Department_Class_Label__c = '其他';
        //strategicDep.Hospital__c = hospital.Id;
        strategicDep.ParentId = hospital.Id;
        insert strategicDep;

        // 診療科を作る
        Account dep = new Account();
        dep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_OTH'].id;
        dep.Name = 'test dep';
        //dep.AgentCode_Ext__c = '99998';
        dep.ParentId = strategicDep.Id;
        //dep.Department_Class__c = strategicDep.Id;
        //dep.Hospital__c = hospital.Id;
        insert dep;
        
        System.debug('診療科 insert 完了!');

        // 产品
        Product2 pro1 = new Product2(Name='name01',IsActive=true,Family='GI');

        insert new Product2[] {pro1};

        List<Asset> asList = new List<Asset>();
    	for(Integer i=0;i<num;i++){
    		Asset assetA1 = new Asset();
            //assetA1.RecordTypeId = System.Label.Asset_RecordType;
            assetA1.SerialNumber = 'ass'+i;
            assetA1.Name = 'ass'+i;
            assetA1.AccountId = dep.Id;
            //assetA1.Department_Class__c = strategicDep.Id;
            //assetA1.Hospital__c = hospital.Id;
            assetA1.Product2Id = pro1.Id;
            assetA1.Quantity = 1;
            assetA1.Status = '有库存';
            //assetA1.Manage_type__c = '个体管理';
            //assetA1.Loaner_accsessary__c = false;
            //assetA1.Out_of_wh__c = 0;
            //assetA1.Salesdepartment__c = '1.华北营业本部';
            //assetA1.Internal_asset_location__c = '北京 备品中心';
            //assetA1.Product_category__c = 'GI';
            assetA1.Equipment_Type__c = '产品试用';
            //assetA1.SalesProvince__c = '北京';
    		asList.add(assetA1);
    	}
    	insert asList;
    	return asList;
    }
    public static List<loaner_application__c> CreateLoanerApplications(Integer num){
        List<RecordType> rectLo = [select Id from RecordType where IsActive = true and SobjectType = 'loaner_application__c' and Name = 'IE'];   
        List<loaner_application__c> laList = new List<loaner_application__c>();
        for(Integer i =0;i<num;i++){
            loaner_application__c loaner = new loaner_application__c();
            loaner.Name = 'TEST'+i;
            loaner.RecordTypeId = rectLo[0].id;
            loaner.EC_CODE_1__C = 'DV2-CAMELEONS-CUBE';
            loaner.DEMO_PURPOSE__C = '演示';
            loaner.Request_shipping_Date__c = Date.today().addDays(10);
            loaner.Request_return_Date__c = Date.today().addDays(10);
            loaner.Status__c = '部分发货';
            loaner.Return_Track_Company__c = '物流公司';
            loaner.pickup_time__c  = Date.today();
            loaner.Rental_Start_Date__c = Date.today().addDays(1);
            loaner.Rental_End_Date__c  = Date.today().addDays(2);
            //loaner.Return_Trake_Staff__c = '返品人';
            laList.add(loaner);
        }
        insert laList;
        return laList;
    }
    public static List<Loaner_Express__c> CreateLoanerExpresses(Integer num){
        //new loaner_application__c
        loaner_application__c la = new loaner_application__c();
        if([SELECT Id FROM loaner_application__c LIMIT 1].size()>0){
            la = [SELECT Id FROM loaner_application__c LIMIT 1];
        }else{
            la = Createloanerapplications(1)[0];
        }
        List<Loaner_Express__c> leList = new List<Loaner_Express__c>();
        for(Integer i =0;i<num;i++){
            Loaner_Express__c le = new Loaner_Express__c(
                Name = 'test'+i,
                loaner_application__c = la.Id,
                NotReceivingNum__c = 3
            );
            leList.add(le);
        }
        insert leList;
        return leList;
    }
    public static List<loaner_application_detail__c> CreateLoanerApplicationDetails(Integer num){
        //new account
        List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = 'Customer IE'];
        Account acc = new Account();
        acc.RecordTypeId = rectCo[0].Id;
        acc.Name         = '客户テスト1';
        acc.DivisionName__c = 'DivisionName__c';
        acc.FacilityName__c = 'FacilityName__c';
        acc.PostCode__c='000000';
        insert acc;
        //new asset
        Asset asset = new Asset();
        asset.Name = 'テスト機器1';
        asset.AccountId = acc.Id;
        asset.SerialNumber = 'testserial';
        insert asset;
        //new loaner_application__c
        loaner_application__c la = new loaner_application__c();
        if([SELECT Id FROM loaner_application__c LIMIT 1].size()>0){
            la = [SELECT Id FROM loaner_application__c LIMIT 1];
        }else{
            la = Createloanerapplications(1)[0];
        }
        List<loaner_application_detail__c> ladList = new List<loaner_application_detail__c>();
        for(Integer i =0;i<num;i++){
            loaner_application_detail__c detail = new loaner_application_detail__c();
            detail.loaner_application__c = la.Id;
            detail.loaner__c = asset.id;
            detail.name = 'Test'+i;
            detail.RAESD_STATUS__C = '欠品中';
            //detail.Loaner_Express__c = le.id;
            //loaner.Return_Trake_Staff__c = '返品人';
            ladList.add(detail);
        }
        insert ladList;
        return ladList;
    }
    public static List<User_FaultInfo__c> CreateUserFaultInfos(Integer num){
        List<User_FaultInfo__c> ufList = new List<User_FaultInfo__c>();
        for(Integer i=0;i<num;i++){
            User_FaultInfo__c uf = new User_FaultInfo__c();
            uf.ORIGIN__c = 'Web';
            uf.SUBJECT__c = 'test'+i;
            uf.OFFICE_OWNER__c = 'Beijing';
            uf.Product_Type__c = 'NDT';
            uf.TYPE__c = 'Service';
            uf.LOGISTICS_SHIPMENT_TYPE__c = 'Domestic';
            uf.STATUS__c = 'Not Started';
            uf.PRIORITY__c = 'High';
            ufList.add(uf);
        }
        insert ufList;
        return ufList;
    }
    public static List<Quotes__c> CreateQuotes(Integer num){
        List<Quotes__c> qList = new List<Quotes__c>();
        for(Integer i=0;i<num;i++){
            Quotes__c quotes = new Quotes__c();
            quotes.QuotesType__c = '零件报价单';
            quotes.DATE__c = Date.today();
            quotes.LEAD_TIME__c = '1 week';
            quotes.STATUS__c = 'Qualifying';
            quotes.LOCATION__c = 'China - Service';
            quotes.TERMS__c = '1% 10 Net 30';
            quotes.EXPIRES__c = Date.today();
            quotes.EXP_CLOSE__c = Date.today();
            quotes.ORDER_TYPE__c = 'LS Core Clinical';
            qList.add(quotes);
        }
        insert qList;
        return qList;
    }
    public static List<Repair__c> CreateRepairs (Integer num){
        List<Repair__c> repList = new List<Repair__c>();
        for(Integer i =0;i<num;i++){
            Repair__c rep = new Repair__c();
            rep.Name='test'+i;
            rep.ServicePlace__c='现场';
            repList.add(rep);
        }
        insert repList;
        return repList;
    }
    public static List<loaner_user__c> CreateLoanerUsers(Integer num){
        //new Contact
        Contact con = new Contact();
        if([SELECT Id,Name,AccountId FROM Contact LIMIT 1].size()>0){
            con = [SELECT Id,Name,AccountId FROM Contact LIMIT 1];
        }else{
            con = CreateContacts(1)[0];
        }
        //new loaner_application__c
        loaner_application__c la = new loaner_application__c();
        if([SELECT Id FROM loaner_application__c LIMIT 1].size()>0){
            la = [SELECT Id FROM loaner_application__c LIMIT 1];
        }else{
            la = Createloanerapplications(1)[0];
        }
        List<loaner_user__c> luList = new List<loaner_user__c>();
        for(Integer i=0;i<num;i++){
            loaner_user__c lu = new loaner_user__c();
            lu.Customer__c = con.AccountId;
            lu.Contact__c = con.id;
            lu.loaner_application__c = la.id;
            lu.Remarks__c = 'Test'+i;
            luList.add(lu);
        }
        insert luList;
        return luList;
    }
    public static List<Order> CreateOrders(Integer num){
        //new Contact
        Contact con = new Contact();
        if([SELECT Id,Name,AccountId FROM Contact LIMIT 1].size()>0){
            con = [SELECT Id,Name,AccountId FROM Contact LIMIT 1];
        }else{
            con = CreateContacts(1)[0];
        }
        //new Opportunity
        Opportunity opp = new Opportunity();
        if([SELECT Id,Name FROM Opportunity LIMIT 1].size()>0){
            opp = [SELECT Id,Name FROM Opportunity LIMIT 1];
        }else{
            opp = CreateOpportunitys(1)[0];
        }
        // opp.StageName = 'Phase3';
        // update opp;
        //new Order
        List<Order> odList = new List<Order>();
        for(Integer i=0;i<num;i++){
            Order od = new Order(
            Name = 'TestOrder'+i,
            Status = 'Draft',
            Status__c = 'Active',
            AccountId = con.AccountId,
            ApproveStatus__c = 'Draft',
            OpportunityId = opp.Id,
            // ForeignTradeCompany_D__c = con.AccountId,
            EffectiveDate = Date.today(),
            IE_SP5_D__c = true,
            IE_SP8__c = true,
            SpecialDeliveryAccount_D__c = con.AccountId,
            SpecialDeliveryContact2_D__c = con.Id,
            EndUser__c = con.Id
        );
            odList.add(od);
        }
        insert odList;
        return odList;
    }
    public static List<CampaignMember> CreateCampaignMember(Integer num){
    	List<CampaignMember> addList = new List<CampaignMember>();
    	//Repair__c rp = CreateRepairs(1)[0];
        Campaign Cam= new Campaign();
        Cam.Name = '学会 培训名称';
        //Cam.Live_Demo_report__c = '学会 培训-测试用';
        //Cam.HostName__c = '小明明明';//会议主办方
        //Cam.cooperatorCompany__c = '会议承办方';//会议承办方
        insert Cam;
    	Contact contact4= new Contact();
        //contact4.AccountId = rp.Account__c;
        contact4.FirstName = '小明明明';
        contact4.LastName = 'test4经销商';
        insert contact4;
    	for(Integer i=0;i<num;i++){
    		CampaignMember add = new CampaignMember();
            
			add.ContactId = contact4.id;//客户人员， Contact
			//add.MobilePhone__c = '123123666'+i;
            add.CampaignId = Cam.Id;
			
    		addList.add(add);
    	}
    	insert addList;
    	return addList;
    }
    
    public static List<case> CreateCase(Integer num){
    	List<case> addList = new List<case>();
    	//Repair__c rp = CreateRepairs(1)[0];
        Account aC = CreateAccounts(1)[0];
    	Contact contact5= new Contact();
        //contact5.AccountId = rp.Account__c;
        contact5.FirstName = '小明明明明';
        contact5.LastName = 'test4经销商';
        insert contact5;
    	for(Integer i=0;i<num;i++){
    		case add = new case();
            
			add.ContactId = contact5.id;//客户人员姓名， Contact
            //add.Account__c = aC.Id;//客户名称， Account
			add.Subject = 'Test For Case'+i;
			
    		addList.add(add);
    	}
    	insert addList;
    	return addList;
    }
    
    public static List<Event> CreateEvent(Integer num){
    	List<Event> addList = new List<Event>();
    	for(Integer i=0;i<num;i++){
    		Event add = new Event();
            
			add.Type = '電話';
			add.Description = 'Test for Event'+i;
            add.DurationInMinutes = 1;//持续时间
			add.ActivityDateTime = Datetime.valueOf('2022-03-17 00:00:00');
    		addList.add(add);
    	}
    	insert addList;
    	return addList;
    }
    

    
    public static List<Lead> CreateLead(Integer num){
    	List<Lead> addList = new List<Lead>();
		//Repair__c rp = CreateRepairs(1)[0];
        
        /*Asset ast = CreateAssets(1)[0];
        Account strategicDep = new Account();
        strategicDep.recordtypeId = [Select Id FROM RecordType WHERE IsActive = true and SobjectType = 'Account' and DeveloperName = 'Department_Class_OTH'].id;
        strategicDep.Name = 'Olympus社内 其他';
        strategicDep.Department_Class_Label__c = '其他';
        strategicDep.Hospital__c = ast.Hospital__c;
        strategicDep.ParentId = ast.Hospital__c;
        insert strategicDep;
       战略科室分类要和母公司一样     描述	Not(IsBlank(Hospital__c)) 
                                            && Parent.Parent.RecordTypeId = '01210000000QemG' 
                                            && Department_Class__c <> ParentId

        不能更改战略科室的客户名              RecordTypeId != '01210000000QemG' && ISBLANK(Parent.ParentId) 
                                      && Parent.RecordTypeId = '01210000000QemG' && ISCHANGED(Name) && !Sys_Dept_Name_Change_Chk__c
        战略科室的医院要和科室的医院一致        IF(Parent.Parent.RecordTypeId = '01210000000QemG',IF(Hospital__c <> Parent.ParentId,TRUE,FALSE),FALSE)
	                                        
*/
        
        Account aC = CreateAccounts(1)[0];
        //Contact contactTest = CreateContacts(1)[0];
        //aC.Department_Class__c = '0010l00001PQF0SAAX';
        //aC.ParentId = '0010l00001PQF0SAAX';
        //update aC;
    	Contact contact12= new Contact();
        contact12.AccountId = aC.Id;
        contact12.FirstName = '小明明明明';
        contact12.LastName = 'test12经销商';
        insert contact12;
        Account acc = [SELECT Id,Name,parentId,Parent.Parent.RecordTypeId FROM Account WHERE Id =:contact12.AccountId ];
        //acc.Department_Class__c = acc.parentId;
        System.debug('acc-----------'+acc);
        System.debug('acc.parentId-----------'+acc.parentId);
        System.debug('acc.Parent.Parent.RecordTypeId-----------'+acc.Parent.Parent.RecordTypeId);
        update acc;
        //战略科室分类要和母公司一样: []
        //Not(IsBlank(Hospital__c)) && Parent.Parent.RecordTypeId = '01210000000QemG' && Department_Class__c <> ParentId
    	for(Integer i=0;i<num;i++){
    		Lead add = new Lead();
            
			add.Phone = '123123666'+i;//电话
			//add.Hospital_Name__c = acc.Id;//客户
			//add.Contact_Name__c = contact12.Id;//客户姓名
            //add.Department_Class__c = acc.Department_Class__c;
            //Hospital_Name__c = Contact_Name__r.AccountId   潜在客户: 医院名 ID等于客户姓名: 客户名 ID   
			//Hospital_Name__r.Department_Class__c != Department_Class__c
			//LastName, Company
			add.LastName = 'TestLName'+i;
            add.Company = 'TestCompany';
    		addList.add(add);
    	}
    	insert addList;
        //	与医院名的战略科室分类不一致
        //  AND(NOT(ISBLANK(Hospital_Name__c)),Hospital_Name__r.Department_Class__c != Department_Class__c, $User.Batch_User__c ==FALSE)
        //Hospital_Name__c 不为空 时 需要让 Hospital_Name__r.Department_Class__c == Department_Class__c
    	return addList;
    }


/*****************************/    
    public class CreatePIHelperHttpMock implements HttpCalloutMock {
        public HTTPResponse respond(HTTPRequest req) {
            Map<String, Object> testMap = new Map<String, Object>();
            testMap.put('Account',CreateAccounts(1)[0]);
            testMap.put('success',true);
            String mapJson = JSON.serialize(testMap);
            HttpResponse res = new HttpResponse();
            res.setHeader('Content-Type', 'text/html');
            res.setBody(mapJson); 
            res.setStatusCode(200);
            return res;
        }
    }

    public class CreateMetaDataUtilityHttpMock implements HttpCalloutMock {
        public HTTPResponse respond(HTTPRequest req) {
            HttpResponse res = new HttpResponse();
            res.setHeader('Content-Type', 'text/html');
            res.setBody('{"size":2,"totalSize":2,"done":true,"queryLocator":null,"entityTypeName":"ProfileLayout","records":[{"attributes":{"type":"ProfileLayout","url":"/services/data/v41.0/tooling/sobjects/ProfileLayout/01G1000000hlD1YEAU"},"Layout":{"attributes":{"type":"Layout","url":"/services/data/v41.0/tooling/sobjects/Layout/00h10000009iAb5AAE"},"Name":".客户人员レイアウト","TableEnumOrId":"01I10000000er3hEAA"},"ProfileId":"00e10000000NawVAAS","Profile":{"attributes":{"type":"Profile","url":"/services/data/v41.0/tooling/sobjects/Profile/00e10000000NawVAAS"},"Name":"901_经销商社区普通权限"},"RecordTypeId":null},{"attributes":{"type":"ProfileLayout","url":"/services/data/v41.0/tooling/sobjects/ProfileLayout/01G1000000hlD7CEAU"},"Layout":{"attributes":{"type":"Layout","url":"/services/data/v41.0/tooling/sobjects/Layout/00h10000009iAb5AAE"},"Name":".客户人员レイアウト","TableEnumOrId":"01I10000000er3hEAA"},"ProfileId":"00e10000000NawVAAS","Profile":{"attributes":{"type":"Profile","url":"/services/data/v41.0/tooling/sobjects/Profile/00e10000000NawVAAS"},"Name":"901_经销商社区普通权限"},"RecordTypeId":"012100000006KW5AAM"}]}'); 
            res.setStatusCode(200);
            res.setStatus('OK');
            return res;
        }
    }

    public class BaseHttpMock implements HttpCalloutMock {

        String body ='';
        String status = '';
        String statusCode = '';
        public BaseHttpMock(String body,String status,String statusCode){
            this.body = body;
            this.status = status;
            this.statusCode = statusCode;
        }

        public HTTPResponse respond(HTTPRequest req) {
            HttpResponse res = new HttpResponse();
            res.setHeader('Content-Type', 'application/json');
            res.setBody(body); 
            res.setStatusCode(200);
            res.setStatus('OK');
            return res;
        }
    }

}