{
    "timestamp": "2026-05-04 18:44:33",
    "message": "♻️ Token valide (cache)"
}
{
    "timestamp": "2026-05-04 18:44:35",
    "message": "DEBUG create_all - payload reçu",
    "context": {
        "Agent": {
            "FirstName": "Thomas",
            "LastName": "Raymond",
            "Email": "thomas.raymond@trudel.ca",
            "Job": "Architecte de Solutions "
        },
        "Clients": [
            {
                "FirstName": "James",
                "LastName": "Bond",
                "Email": "James.bond@trudel.ca",
                "Phone": "",
                "Post": ""
            }
        ],
        "Projects_count": 1,
        "GeneralInfo": {
            "Date": "2026.05.04",
            "VisitTime": 65.64731597900390625,
            "Pet": "",
            "UnitsSeeked": [],
            "Comment": ""
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:35",
    "message": "DEBUG create_all - meetingDateTimeIso calculé",
    "context": {
        "MeetingDateTime_input": null,
        "meetingDateTimeIso": null
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "✅ lookup_asset_by_building_name - trouvé (exact)",
    "context": {
        "assetId": "02ibZ000002q8npQAA",
        "buildingGroupId": "02ibZ000002pXiLQAU",
        "building": "Le18Juillet-2"
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG create_all - bâtiment résolu",
    "context": {
        "residentialBuildingName": "Le18Juillet-2",
        "residentialBuildingAssetId": "02ibZ000002q8npQAA",
        "buildingGroupId": "02ibZ000002pXiLQAU"
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG create_all - recherche ownerId via email agent",
    "context": {
        "agentEmail": "thomas.raymond@trudel.ca",
        "http": 200,
        "res": {
            "totalSize": 1,
            "done": true,
            "records": [
                {
                    "attributes": {
                        "type": "User",
                        "url": "\/services\/data\/v62.0\/sobjects\/User\/005OF000001ng5aYAA"
                    },
                    "Id": "005OF000001ng5aYAA"
                }
            ]
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG create_all - ownerId retenu",
    "context": {
        "ownerId": "005OF000001ng5aYAA"
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG find_existing_lead_for_clients - requête Lead",
    "context": {
        "soql": "SELECT Id, FirstName, LastName, Company, Email, Phone, Status, IsConverted, ConvertedOpportunityId\r\n             FROM Lead\r\n             WHERE IsConverted = false\r\n             AND (Email IN ('James.bond@trudel.ca'))\r\n             ORDER BY CreatedDate DESC\r\n             LIMIT 1",
        "emails": [
            "James.bond@trudel.ca"
        ],
        "phones": []
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG find_existing_lead_for_clients - résultat requête Lead",
    "context": {
        "http": 200,
        "res": {
            "totalSize": 0,
            "done": true,
            "records": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG find_existing_lead_for_clients - lead retenu",
    "context": {
        "lead": null
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG create_all - lead après recherche",
    "context": {
        "lead": null
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG find_existing_opportunity_by_client_email_or_phone - recherche Contact",
    "context": {
        "soql": "SELECT Id FROM Contact\r\n                    WHERE (Email IN ('James.bond@trudel.ca'))\r\n                    ORDER BY CreatedDate DESC LIMIT 1"
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG find_existing_opportunity_by_client_email_or_phone - aucun Contact trouvé",
    "context": {
        "http": 200,
        "res": {
            "totalSize": 0,
            "done": true,
            "records": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG create_all - aucun lead trouvé, passage direct au flow classique",
    "context": {
        "clients": [
            {
                "FirstName": "James",
                "LastName": "Bond",
                "Email": "James.bond@trudel.ca",
                "Phone": "",
                "Post": ""
            }
        ]
    }
}
{
    "timestamp": "2026-05-04 18:44:36",
    "message": "DEBUG create_all - entrée dans le flow classique",
    "context": []
}
{
    "timestamp": "2026-05-04 18:44:37",
    "message": "DEBUG sf_find_contact_by_email_or_phone - search by email",
    "context": {
        "email": "James.bond@trudel.ca",
        "http": 200,
        "res": {
            "totalSize": 0,
            "done": true,
            "records": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:37",
    "message": "DEBUG sf_find_contact_by_email_or_phone - no contact found",
    "context": {
        "email": "James.bond@trudel.ca",
        "phone": null
    }
}
{
    "timestamp": "2026-05-04 18:44:37",
    "message": "DEBUG upsert_contacts_with_shared_family_account - primary contact lookup",
    "context": {
        "email": "James.bond@trudel.ca",
        "phone": "",
        "existingPrimaryContact": null
    }
}
{
    "timestamp": "2026-05-04 18:44:37",
    "message": "DEBUG upsert_contacts_with_shared_family_account - family account created",
    "context": {
        "accountId": "001bZ00000NqYWkQAN",
        "payload": {
            "Name": "James Bond",
            "Phone": null,
            "OwnerId": "005OF000001ng5aYAA",
            "RecordTypeId": "0128a000000NQfvAAG"
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:37",
    "message": "DEBUG sf_find_contact_by_email_or_phone - search by email",
    "context": {
        "email": "James.bond@trudel.ca",
        "http": 200,
        "res": {
            "totalSize": 0,
            "done": true,
            "records": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:37",
    "message": "DEBUG sf_find_contact_by_email_or_phone - no contact found",
    "context": {
        "email": "James.bond@trudel.ca",
        "phone": null
    }
}
{
    "timestamp": "2026-05-04 18:44:37",
    "message": "DEBUG upsert_contacts_with_shared_family_account - contact lookup",
    "context": {
        "email": "James.bond@trudel.ca",
        "phone": "",
        "existingContact": null
    }
}
{
    "timestamp": "2026-05-04 18:44:40",
    "message": "DEBUG upsert_contacts_with_shared_family_account - contact created",
    "context": {
        "contactId": "003bZ00000XdGoPQAV",
        "accountId": "001bZ00000NqYWkQAN",
        "payload": {
            "FirstName": "James",
            "LastName": "Bond",
            "Email": "James.bond@trudel.ca",
            "Phone": null,
            "AccountId": "001bZ00000NqYWkQAN",
            "OwnerId": "005OF000001ng5aYAA",
            "RecordTypeId": "0128a000001CI9rAAG"
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:40",
    "message": "DEBUG create_all - résultat upsert family account\/contact",
    "context": {
        "accountMainId": "001bZ00000NqYWkQAN",
        "contactIds": [
            "003bZ00000XdGoPQAV"
        ]
    }
}
{
    "timestamp": "2026-05-04 18:44:41",
    "message": "DEBUG create_all - oppPayload avant recherche d'opp existante",
    "context": {
        "oppPayload": {
            "Name": "James Bond",
            "StageName": "Qualification",
            "CloseDate": "2026-06-03",
            "AccountId": "001bZ00000NqYWkQAN",
            "Description": "",
            "Contact__c": "003bZ00000XdGoPQAV",
            "OwnerId": "005OF000001ng5aYAA",
            "Residential_Building__c": "02ibZ000002q8npQAA",
            "Building_Group__c": "02ibZ000002pXiLQAU",
            "RecordTypeId": "0128a000001CIA1AAO"
        },
        "contactMainId": "003bZ00000XdGoPQAV"
    }
}
{
    "timestamp": "2026-05-04 18:44:41",
    "message": "DEBUG find_existing_open_opportunity_for_contact_and_building - paramètres",
    "context": {
        "contactId": "003bZ00000XdGoPQAV",
        "buildingsPicklist": null,
        "buildingGroupAccountId": "02ibZ000002pXiLQAU",
        "days": 180,
        "whereVariants": [
            "Opportunity.Building_Group__c = '02ibZ000002pXiLQAU'",
            "Id != null"
        ]
    }
}
{
    "timestamp": "2026-05-04 18:44:41",
    "message": "DEBUG find_existing_open_opportunity_for_contact_and_building - requête",
    "context": {
        "soql": "SELECT OpportunityId, Opportunity.Id, Opportunity.Name, Opportunity.StageName, Opportunity.CreatedDate\r\n                 FROM OpportunityContactRole\r\n                 WHERE ContactId = '003bZ00000XdGoPQAV'\r\n                 AND Opportunity.IsClosed = false\r\n                 AND Opportunity.CreatedDate = LAST_N_DAYS:180\r\n                 AND Opportunity.Building_Group__c = '02ibZ000002pXiLQAU'\r\n                 ORDER BY Opportunity.CreatedDate DESC\r\n                 LIMIT 1"
    }
}
{
    "timestamp": "2026-05-04 18:44:41",
    "message": "DEBUG find_existing_open_opportunity_for_contact_and_building - résultat",
    "context": {
        "http": 200,
        "res": {
            "totalSize": 0,
            "done": true,
            "records": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:41",
    "message": "DEBUG find_existing_open_opportunity_for_contact_and_building - requête",
    "context": {
        "soql": "SELECT OpportunityId, Opportunity.Id, Opportunity.Name, Opportunity.StageName, Opportunity.CreatedDate\r\n                 FROM OpportunityContactRole\r\n                 WHERE ContactId = '003bZ00000XdGoPQAV'\r\n                 AND Opportunity.IsClosed = false\r\n                 AND Opportunity.CreatedDate = LAST_N_DAYS:180\r\n                 AND Id != null\r\n                 ORDER BY Opportunity.CreatedDate DESC\r\n                 LIMIT 1"
    }
}
{
    "timestamp": "2026-05-04 18:44:41",
    "message": "DEBUG find_existing_open_opportunity_for_contact_and_building - résultat",
    "context": {
        "http": 200,
        "res": {
            "totalSize": 0,
            "done": true,
            "records": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:41",
    "message": "DEBUG find_existing_open_opportunity_for_contact_and_building - aucune opp existante trouvée",
    "context": {
        "contactId": "003bZ00000XdGoPQAV"
    }
}
{
    "timestamp": "2026-05-04 18:44:41",
    "message": "DEBUG create_all - existingOppId",
    "context": {
        "existingOppId": null
    }
}
{
    "timestamp": "2026-05-04 18:44:41",
    "message": "DEBUG create_all - aucune opp existante, création Opportunity",
    "context": {
        "oppPayload": {
            "Name": "James Bond",
            "StageName": "Qualification",
            "CloseDate": "2026-06-03",
            "AccountId": "001bZ00000NqYWkQAN",
            "Description": "",
            "Contact__c": "003bZ00000XdGoPQAV",
            "OwnerId": "005OF000001ng5aYAA",
            "Residential_Building__c": "02ibZ000002q8npQAA",
            "Building_Group__c": "02ibZ000002pXiLQAU",
            "RecordTypeId": "0128a000001CIA1AAO"
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:42",
    "message": "DEBUG create_all - réponse création Opportunity",
    "context": {
        "http": 201,
        "resp": {
            "id": "006bZ00000VvqcjQAB",
            "success": true,
            "errors": []
        },
        "oppId": "006bZ00000VvqcjQAB"
    }
}
{
    "timestamp": "2026-05-04 18:44:42",
    "message": "DEBUG create_all - visitPayload final",
    "context": {
        "visitPayload": {
            "Opportunity__c": "006bZ00000VvqcjQAB",
            "Assign_to__c": "005OF000001ng5aYAA",
            "Contact_1__c": "003bZ00000XdGoPQAV",
            "Meeting_Date_Time__c": "2026-05-04T18:44:42Z",
            "Meeting_Notes__c": "",
            "Visit_Duration__c": 2
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:43",
    "message": "DEBUG upsert_visit - vérification Opportunity__c après création",
    "context": {
        "visitId": "a03bZ00000Xd29pQAB",
        "savedOppId": "006bZ00000VvqcjQAB",
        "expectedOppId": "006bZ00000VvqcjQAB"
    }
}
{
    "timestamp": "2026-05-04 18:44:43",
    "message": "DEBUG create_all - résultat upsert Visit__c",
    "context": {
        "okVisit": true,
        "visitMode": "create",
        "visitId": "a03bZ00000Xd29pQAB",
        "visitHttp": 201,
        "visitRes": {
            "id": "a03bZ00000Xd29pQAB",
            "success": true,
            "errors": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:43",
    "message": "DEBUG create_all - visitedUnits source finale",
    "context": {
        "visitedUnits": [
            "1050_Le18Juillet-2",
            "826_Le18Juillet-1",
            "1177_Le18Juillet-2"
        ]
    }
}
{
    "timestamp": "2026-05-04 18:44:43",
    "message": "DEBUG create_all - defaultVURecordTypeId",
    "context": {
        "defaultVURecordTypeId": "0128a000000tkjSAAQ"
    }
}
{
    "timestamp": "2026-05-04 18:44:43",
    "message": "DEBUG create_all - estimatesByUnit",
    "context": {
        "estimatesByUnit": {
            "1177": {
                "Unit": "1177",
                "ServicesAndOptionsIncluded": [
                    "Piscine extérieure au toit",
                    "Salle de mise en forme",
                    "Cuisine d’été",
                    "Salle de réception ($)",
                    "Suite d’invité locative ($)",
                    "Stations lave-auto",
                    "Salle de rangement à vélos sécurisée",
                    "Eau chaude",
                    "Air climatisé"
                ],
                "ServicesAndOptions": [],
                "ServicesAndOptionsMultiple": [
                    {
                        "Name": "Rangement grillagé sur étage (à partir de)",
                        "Number": 1,
                        "Price": 75
                    },
                    {
                        "Name": "Rangement grillagé souterrain (à partir de)",
                        "Number": 1,
                        "Price": 55
                    },
                    {
                        "Name": "Stationnement moto (à partir de)",
                        "Number": 1,
                        "Price": 35
                    }
                ],
                "ServicesAndOptionsPrice": 165,
                "UnitPrice": 2795,
                "Deduction": 0,
                "OtherFees": 0,
                "FinalPrice": 2960
            }
        }
    }
}
{
    "timestamp": "2026-05-04 18:44:43",
    "message": "DEBUG create_visited_units_for_visit - Positive_Aspects analysis",
    "context": {
        "unit": "1050_Le18Juillet-2",
        "requested": [],
        "allowed": [],
        "valid": [],
        "invalid": []
    }
}
{
    "timestamp": "2026-05-04 18:44:44",
    "message": "DEBUG create_visited_units_for_visit - Positive_Aspects analysis",
    "context": {
        "unit": "826_Le18Juillet-1",
        "requested": [],
        "allowed": [],
        "valid": [],
        "invalid": []
    }
}
{
    "timestamp": "2026-05-04 18:44:44",
    "message": "DEBUG create_visited_units_for_visit - Positive_Aspects analysis",
    "context": {
        "unit": "1177_Le18Juillet-2",
        "requested": [
            "Prix"
        ],
        "allowed": [],
        "valid": [
            "Prix"
        ],
        "invalid": []
    }
}
{
    "timestamp": "2026-05-04 18:44:45",
    "message": "✅ create_all executed",
    "context": {
        "OpportunityId": "006bZ00000VvqcjQAB",
        "VisitId": "a03bZ00000Xd29pQAB",
        "VisitMode": "create",
        "LeadConversion": null,
        "VisitedUnits": [
            {
                "ok": true,
                "unit": "1050_Le18Juillet-2",
                "id": "a01bZ00000NqcnAQAR",
                "http": 201
            },
            {
                "ok": true,
                "unit": "826_Le18Juillet-1",
                "id": "a01bZ00000NqUPnQAN",
                "http": 201
            },
            {
                "ok": true,
                "unit": "1177_Le18Juillet-2",
                "id": "a01bZ00000Nqf5NQAR",
                "http": 201
            }
        ]
    }
}
{
    "timestamp": "2026-05-04 18:51:59",
    "message": "♻️ Token valide (cache)"
}
{
    "timestamp": "2026-05-04 18:52:02",
    "message": "DEBUG create_all - payload reçu",
    "context": {
        "Agent": {
            "FirstName": "Thomas",
            "LastName": "Raymond",
            "Email": "thomas.raymond@trudel.ca",
            "Job": "Architecte de Solutions "
        },
        "Clients": [
            {
                "FirstName": "Nathan",
                "LastName": "Drake",
                "Email": "Nathan.drake@trudel.ca",
                "Phone": "",
                "Post": ""
            }
        ],
        "Projects_count": 1,
        "GeneralInfo": {
            "Date": "2026.05.04",
            "VisitTime": 46.727352142333984375,
            "Pet": "",
            "UnitsSeeked": [],
            "Comment": ""
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:02",
    "message": "DEBUG create_all - meetingDateTimeIso calculé",
    "context": {
        "MeetingDateTime_input": null,
        "meetingDateTimeIso": null
    }
}
{
    "timestamp": "2026-05-04 18:52:02",
    "message": "✅ lookup_asset_by_building_name - trouvé (exact)",
    "context": {
        "assetId": "02ibZ000002q8npQAA",
        "buildingGroupId": "02ibZ000002pXiLQAU",
        "building": "Le18Juillet-2"
    }
}
{
    "timestamp": "2026-05-04 18:52:02",
    "message": "DEBUG create_all - bâtiment résolu",
    "context": {
        "residentialBuildingName": "Le18Juillet-2",
        "residentialBuildingAssetId": "02ibZ000002q8npQAA",
        "buildingGroupId": "02ibZ000002pXiLQAU"
    }
}
{
    "timestamp": "2026-05-04 18:52:02",
    "message": "DEBUG create_all - recherche ownerId via email agent",
    "context": {
        "agentEmail": "thomas.raymond@trudel.ca",
        "http": 200,
        "res": {
            "totalSize": 1,
            "done": true,
            "records": [
                {
                    "attributes": {
                        "type": "User",
                        "url": "\/services\/data\/v62.0\/sobjects\/User\/005OF000001ng5aYAA"
                    },
                    "Id": "005OF000001ng5aYAA"
                }
            ]
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:02",
    "message": "DEBUG create_all - ownerId retenu",
    "context": {
        "ownerId": "005OF000001ng5aYAA"
    }
}
{
    "timestamp": "2026-05-04 18:52:02",
    "message": "DEBUG find_existing_lead_for_clients - requête Lead",
    "context": {
        "soql": "SELECT Id, FirstName, LastName, Company, Email, Phone, Status, IsConverted, ConvertedOpportunityId\r\n             FROM Lead\r\n             WHERE IsConverted = false\r\n             AND (Email IN ('Nathan.drake@trudel.ca'))\r\n             ORDER BY CreatedDate DESC\r\n             LIMIT 1",
        "emails": [
            "Nathan.drake@trudel.ca"
        ],
        "phones": []
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG find_existing_lead_for_clients - résultat requête Lead",
    "context": {
        "http": 200,
        "res": {
            "totalSize": 1,
            "done": true,
            "records": [
                {
                    "attributes": {
                        "type": "Lead",
                        "url": "\/services\/data\/v62.0\/sobjects\/Lead\/00QbZ00000GC7hFUAT"
                    },
                    "Id": "00QbZ00000GC7hFUAT",
                    "FirstName": "Nathan",
                    "LastName": "Drake",
                    "Company": "Drake",
                    "Email": "nathan.drake@trudel.ca",
                    "Phone": null,
                    "Status": "New",
                    "IsConverted": false,
                    "ConvertedOpportunityId": null
                }
            ]
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG find_existing_lead_for_clients - lead retenu",
    "context": {
        "lead": {
            "attributes": {
                "type": "Lead",
                "url": "\/services\/data\/v62.0\/sobjects\/Lead\/00QbZ00000GC7hFUAT"
            },
            "Id": "00QbZ00000GC7hFUAT",
            "FirstName": "Nathan",
            "LastName": "Drake",
            "Company": "Drake",
            "Email": "nathan.drake@trudel.ca",
            "Phone": null,
            "Status": "New",
            "IsConverted": false,
            "ConvertedOpportunityId": null
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG create_all - lead après recherche",
    "context": {
        "lead": {
            "attributes": {
                "type": "Lead",
                "url": "\/services\/data\/v62.0\/sobjects\/Lead\/00QbZ00000GC7hFUAT"
            },
            "Id": "00QbZ00000GC7hFUAT",
            "FirstName": "Nathan",
            "LastName": "Drake",
            "Company": "Drake",
            "Email": "nathan.drake@trudel.ca",
            "Phone": null,
            "Status": "New",
            "IsConverted": false,
            "ConvertedOpportunityId": null
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG find_existing_opportunity_by_client_email_or_phone - recherche Contact",
    "context": {
        "soql": "SELECT Id FROM Contact\r\n                    WHERE (Email IN ('Nathan.drake@trudel.ca'))\r\n                    ORDER BY CreatedDate DESC LIMIT 1"
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG find_existing_opportunity_by_client_email_or_phone - aucun Contact trouvé",
    "context": {
        "http": 200,
        "res": {
            "totalSize": 0,
            "done": true,
            "records": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG create_all - lead trouvé, entrée dans le flow de conversion",
    "context": {
        "leadId": "00QbZ00000GC7hFUAT",
        "leadEmail": "nathan.drake@trudel.ca",
        "leadStatus": "New"
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG create_all - convertedStatus",
    "context": {
        "convertedStatus": "Qualified"
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG sf_find_contact_by_email_or_phone - search by email",
    "context": {
        "email": "Nathan.drake@trudel.ca",
        "http": 200,
        "res": {
            "totalSize": 0,
            "done": true,
            "records": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG sf_find_contact_by_email_or_phone - no contact found",
    "context": {
        "email": "Nathan.drake@trudel.ca",
        "phone": null
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG create_all - contact existant avant conversion Lead",
    "context": {
        "primaryEmail": "Nathan.drake@trudel.ca",
        "existingContact": null
    }
}
{
    "timestamp": "2026-05-04 18:52:03",
    "message": "DEBUG create_all - payload conversion Lead final",
    "context": {
        "leadId": "00QbZ00000GC7hFUAT",
        "convertPayload": {
            "convertedStatus": "Qualified",
            "doNotCreateOpportunity": false,
            "opportunityName": "Nathan Drake",
            "ownerId": "005OF000001ng5aYAA"
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:04",
    "message": "DEBUG create_all - nullification picklists Lead avant conversion",
    "context": {
        "count": 28,
        "fields": [
            "Language__c",
            "Business_Type__c",
            "Disqualification_Reason__c",
            "Current_situation__c",
            "Type_of_current_property__c",
            "Sector_of_interest__c",
            "et4ae5__Mobile_Country_Code__c",
            "Current_Residence__c",
            "No_specific_date__c",
            "Current_Sector__c",
            "Type_of_unit__c",
            "Bathroom_equipment__c",
            "Type_of_laundry_room__c",
            "Orientation_of_the_sun__c",
            "Floor_of_the_unit__c",
            "Number_of_bathroom_washroom__c",
            "State_of_the_unit__c",
            "View_of_the_unit__c",
            "Office__c",
            "Pet_type_2__c",
            "Pet_type__c",
            "Contact_Preference__c",
            "Deceased_Relative__c",
            "Priority_Needs_Prospect__c",
            "Age_Group_2__c",
            "Age_Group_3__c",
            "Age_Group__c",
            "ic_Newsletter_Requested_if_Disqualified__c"
        ],
        "http": 204
    }
}
{
    "timestamp": "2026-05-04 18:52:04",
    "message": "DEBUG sf_convert_lead - URL Apex REST appelée",
    "context": {
        "instanceUrl": "https:\/\/gestiontrudelalliance123--actif2prep.sandbox.my.salesforce.com",
        "url": "https:\/\/gestiontrudelalliance123--actif2prep.sandbox.my.salesforce.com\/services\/apexrest\/convertLead",
        "payload": {
            "leadId": "00QbZ00000GC7hFUAT",
            "convertedStatus": "Qualified",
            "doNotCreateOpportunity": false,
            "opportunityName": "Nathan Drake",
            "ownerId": "005OF000001ng5aYAA"
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:08",
    "message": "DEBUG sf_convert_lead - réponse conversion via Apex REST",
    "context": {
        "leadId": "00QbZ00000GC7hFUAT",
        "http": 200,
        "res": {
            "errors": [],
            "opportunityId": "006bZ00000Vvn70QAB",
            "contactId": "003bZ00000XdVSLQA3",
            "accountId": "001bZ00000NqVNZQA3",
            "leadId": "00QbZ00000GC7hFUAT",
            "success": true
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:08",
    "message": "DEBUG create_all - résultat conversion Lead",
    "context": {
        "leadConversion": {
            "leadId": "00QbZ00000GC7hFUAT",
            "http": 200,
            "payload": {
                "convertedStatus": "Qualified",
                "doNotCreateOpportunity": false,
                "opportunityName": "Nathan Drake",
                "ownerId": "005OF000001ng5aYAA"
            },
            "res": {
                "errors": [],
                "opportunityId": "006bZ00000Vvn70QAB",
                "contactId": "003bZ00000XdVSLQA3",
                "accountId": "001bZ00000NqVNZQA3",
                "leadId": "00QbZ00000GC7hFUAT",
                "success": true
            }
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:08",
    "message": "✅ Lead converti avec succès",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "accountId": "001bZ00000NqVNZQA3",
        "contactId": "003bZ00000XdVSLQA3"
    }
}
{
    "timestamp": "2026-05-04 18:52:09",
    "message": "✅ Opportunity post-conversion patchée (Contact__c + RecordType)",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "payload": {
            "Contact__c": "003bZ00000XdVSLQA3",
            "RecordTypeId": "0128a000001CIA1AAO"
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:10",
    "message": "✅ sf_transfer_lead_fields_to_opportunity - PATCH Opportunity",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "fields_count": 2,
        "fields": [
            "Residential_Building__c",
            "Building_Group__c"
        ],
        "http": 204,
        "resp": []
    }
}
{
    "timestamp": "2026-05-04 18:52:10",
    "message": "ℹ️ sf_create_secondary_contact_from_lead - aucun 2e contact dans le Lead",
    "context": []
}
{
    "timestamp": "2026-05-04 18:52:10",
    "message": "DEBUG create_all - visitPayload final",
    "context": {
        "visitPayload": {
            "Opportunity__c": "006bZ00000Vvn70QAB",
            "Assign_to__c": "005OF000001ng5aYAA",
            "Contact_1__c": "003bZ00000XdVSLQA3",
            "Meeting_Date_Time__c": "2026-05-04T18:52:10Z",
            "Meeting_Notes__c": "",
            "Visit_Duration__c": 1
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:10",
    "message": "DEBUG upsert_visit - vérification Opportunity__c après création",
    "context": {
        "visitId": "a03bZ00000XdNPyQAN",
        "savedOppId": "006bZ00000Vvn70QAB",
        "expectedOppId": "006bZ00000Vvn70QAB"
    }
}
{
    "timestamp": "2026-05-04 18:52:10",
    "message": "DEBUG create_all - résultat upsert Visit__c",
    "context": {
        "okVisit": true,
        "visitMode": "create",
        "visitId": "a03bZ00000XdNPyQAN",
        "visitHttp": 201,
        "visitRes": {
            "id": "a03bZ00000XdNPyQAN",
            "success": true,
            "errors": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:10",
    "message": "DEBUG create_all - visitedUnits source finale",
    "context": {
        "visitedUnits": [
            "1150_Le18Juillet-2",
            "330_Le18Juillet-1"
        ]
    }
}
{
    "timestamp": "2026-05-04 18:52:11",
    "message": "DEBUG create_all - defaultVURecordTypeId",
    "context": {
        "defaultVURecordTypeId": "0128a000000tkjSAAQ"
    }
}
{
    "timestamp": "2026-05-04 18:52:11",
    "message": "DEBUG create_all - estimatesByUnit",
    "context": {
        "estimatesByUnit": {
            "330": {
                "Unit": "330",
                "ServicesAndOptionsIncluded": [
                    "Piscine extérieure au toit",
                    "Salle de mise en forme",
                    "Cuisine d’été",
                    "Salle de réception ($)",
                    "Suite d’invité locative ($)",
                    "Stations lave-auto",
                    "Salle de rangement à vélos sécurisée",
                    "Eau chaude",
                    "Air climatisé"
                ],
                "ServicesAndOptions": [],
                "ServicesAndOptionsMultiple": [
                    {
                        "Name": "Location borne de recharge",
                        "Number": 1,
                        "Price": 35
                    },
                    {
                        "Name": "Rangement grillagé souterrain (à partir de)",
                        "Number": 1,
                        "Price": 55
                    }
                ],
                "ServicesAndOptionsPrice": 90,
                "UnitPrice": 3035,
                "Deduction": 0,
                "OtherFees": 0,
                "FinalPrice": 3125
            }
        }
    }
}
{
    "timestamp": "2026-05-04 18:52:11",
    "message": "DEBUG create_visited_units_for_visit - Positive_Aspects analysis",
    "context": {
        "unit": "1150_Le18Juillet-2",
        "requested": [],
        "allowed": [],
        "valid": [],
        "invalid": []
    }
}
{
    "timestamp": "2026-05-04 18:52:11",
    "message": "DEBUG create_visited_units_for_visit - Positive_Aspects analysis",
    "context": {
        "unit": "330_Le18Juillet-1",
        "requested": [
            "Prix"
        ],
        "allowed": [],
        "valid": [
            "Prix"
        ],
        "invalid": []
    }
}
{
    "timestamp": "2026-05-04 18:52:12",
    "message": "✅ create_all executed",
    "context": {
        "OpportunityId": "006bZ00000Vvn70QAB",
        "VisitId": "a03bZ00000XdNPyQAN",
        "VisitMode": "create",
        "LeadConversion": {
            "leadId": "00QbZ00000GC7hFUAT",
            "http": 200,
            "payload": {
                "convertedStatus": "Qualified",
                "doNotCreateOpportunity": false,
                "opportunityName": "Nathan Drake",
                "ownerId": "005OF000001ng5aYAA"
            },
            "res": {
                "errors": [],
                "opportunityId": "006bZ00000Vvn70QAB",
                "contactId": "003bZ00000XdVSLQA3",
                "accountId": "001bZ00000NqVNZQA3",
                "leadId": "00QbZ00000GC7hFUAT",
                "success": true
            }
        },
        "VisitedUnits": [
            {
                "ok": true,
                "unit": "1150_Le18Juillet-2",
                "id": "a01bZ00000NqRF9QAN",
                "http": 201
            },
            {
                "ok": true,
                "unit": "330_Le18Juillet-1",
                "id": "a01bZ00000NqcK8QAJ",
                "http": 201
            }
        ]
    }
}
{
    "timestamp": "2026-05-04 18:54:13",
    "message": "♻️ Token valide (cache)"
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG create_all - payload reçu",
    "context": {
        "Agent": {
            "FirstName": "Thomas",
            "LastName": "Raymond",
            "Email": "thomas.raymond@trudel.ca",
            "Job": "Architecte de Solutions "
        },
        "Clients": [
            {
                "FirstName": "Nathan",
                "LastName": "Drake",
                "Email": "Nathan.drake@trudel.ca",
                "Phone": "",
                "Post": ""
            }
        ],
        "Projects_count": 1,
        "GeneralInfo": {
            "Date": "2026.05.04",
            "VisitTime": 628.10333251953125,
            "Pet": "",
            "UnitsSeeked": [],
            "Comment": ""
        }
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG create_all - meetingDateTimeIso calculé",
    "context": {
        "MeetingDateTime_input": null,
        "meetingDateTimeIso": null
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "✅ lookup_asset_by_building_name - trouvé (exact)",
    "context": {
        "assetId": "02ibZ000002q8npQAA",
        "buildingGroupId": "02ibZ000002pXiLQAU",
        "building": "Le18Juillet-2"
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG create_all - bâtiment résolu",
    "context": {
        "residentialBuildingName": "Le18Juillet-2",
        "residentialBuildingAssetId": "02ibZ000002q8npQAA",
        "buildingGroupId": "02ibZ000002pXiLQAU"
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG create_all - recherche ownerId via email agent",
    "context": {
        "agentEmail": "thomas.raymond@trudel.ca",
        "http": 200,
        "res": {
            "totalSize": 1,
            "done": true,
            "records": [
                {
                    "attributes": {
                        "type": "User",
                        "url": "\/services\/data\/v62.0\/sobjects\/User\/005OF000001ng5aYAA"
                    },
                    "Id": "005OF000001ng5aYAA"
                }
            ]
        }
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG create_all - ownerId retenu",
    "context": {
        "ownerId": "005OF000001ng5aYAA"
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG find_existing_lead_for_clients - requête Lead",
    "context": {
        "soql": "SELECT Id, FirstName, LastName, Company, Email, Phone, Status, IsConverted, ConvertedOpportunityId\r\n             FROM Lead\r\n             WHERE IsConverted = false\r\n             AND (Email IN ('Nathan.drake@trudel.ca'))\r\n             ORDER BY CreatedDate DESC\r\n             LIMIT 1",
        "emails": [
            "Nathan.drake@trudel.ca"
        ],
        "phones": []
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG find_existing_lead_for_clients - résultat requête Lead",
    "context": {
        "http": 200,
        "res": {
            "totalSize": 0,
            "done": true,
            "records": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG find_existing_lead_for_clients - lead retenu",
    "context": {
        "lead": null
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG create_all - lead après recherche",
    "context": {
        "lead": null
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG find_existing_opportunity_by_client_email_or_phone - recherche Contact",
    "context": {
        "soql": "SELECT Id FROM Contact\r\n                    WHERE (Email IN ('Nathan.drake@trudel.ca'))\r\n                    ORDER BY CreatedDate DESC LIMIT 1"
    }
}
{
    "timestamp": "2026-05-04 18:54:15",
    "message": "DEBUG find_existing_opportunity_by_client_email_or_phone - recherche via OCR",
    "context": {
        "contactId": "003bZ00000XdVSLQA3",
        "soql": "SELECT OpportunityId, Opportunity.Building_Group__c\r\n                FROM OpportunityContactRole\r\n                WHERE ContactId = '003bZ00000XdVSLQA3'\r\n                AND Opportunity.IsClosed = false\r\n                AND Opportunity.CreatedDate = LAST_N_DAYS:365\r\n                ORDER BY Opportunity.CreatedDate DESC\r\n                LIMIT 1"
    }
}
{
    "timestamp": "2026-05-04 18:54:16",
    "message": "DEBUG find_existing_opportunity_by_client_email_or_phone - OCR trouvée",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "foundGroupId": "02ibZ000002pXiLQAU"
    }
}
{
    "timestamp": "2026-05-04 18:54:16",
    "message": "✅ Groupe d'immeuble identique — Opportunity réutilisée",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "buildingGroupId": "02ibZ000002pXiLQAU"
    }
}
{
    "timestamp": "2026-05-04 18:54:16",
    "message": "✅ Dédup Opportunity trouvée par email\/téléphone — réutilisation",
    "context": {
        "oppId": "006bZ00000Vvn70QAB"
    }
}
{
    "timestamp": "2026-05-04 18:54:16",
    "message": "✅ Opportunity mise à jour avec bâtiment\/groupe",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "payload": {
            "Residential_Building__c": "02ibZ000002q8npQAA",
            "Building_Group__c": "02ibZ000002pXiLQAU"
        }
    }
}
{
    "timestamp": "2026-05-04 18:54:16",
    "message": "DEBUG create_all - aucun lead trouvé, passage direct au flow classique",
    "context": {
        "clients": [
            {
                "FirstName": "Nathan",
                "LastName": "Drake",
                "Email": "Nathan.drake@trudel.ca",
                "Phone": "",
                "Post": ""
            }
        ]
    }
}
{
    "timestamp": "2026-05-04 18:54:16",
    "message": "DEBUG create_all - visitPayload final",
    "context": {
        "visitPayload": {
            "Opportunity__c": "006bZ00000Vvn70QAB",
            "Assign_to__c": "005OF000001ng5aYAA",
            "Meeting_Date_Time__c": "2026-05-04T18:54:16Z",
            "Meeting_Notes__c": "",
            "Visit_Duration__c": 11
        }
    }
}
{
    "timestamp": "2026-05-04 18:54:16",
    "message": "ℹ️ upsert_visit - Visit__c existante aujourd'hui — réutilisation",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "visitId": "a03bZ00000XdNPyQAN"
    }
}
{
    "timestamp": "2026-05-04 18:54:17",
    "message": "DEBUG create_all - résultat upsert Visit__c",
    "context": {
        "okVisit": true,
        "visitMode": "update",
        "visitId": "a03bZ00000XdNPyQAN",
        "visitHttp": 200,
        "visitRes": {
            "id": "a03bZ00000XdNPyQAN",
            "updated": true
        }
    }
}
{
    "timestamp": "2026-05-04 18:54:17",
    "message": "DEBUG create_all - visitedUnits source finale",
    "context": {
        "visitedUnits": [
            "1250_Le18Juillet-2",
            "1026_Le18Juillet-1"
        ]
    }
}
{
    "timestamp": "2026-05-04 18:54:17",
    "message": "DEBUG create_all - defaultVURecordTypeId",
    "context": {
        "defaultVURecordTypeId": "0128a000000tkjSAAQ"
    }
}
{
    "timestamp": "2026-05-04 18:54:17",
    "message": "DEBUG create_all - estimatesByUnit",
    "context": {
        "estimatesByUnit": {
            "1026": {
                "Unit": "1026",
                "ServicesAndOptionsIncluded": [
                    "Piscine extérieure au toit",
                    "Salle de mise en forme",
                    "Cuisine d’été",
                    "Salle de réception ($)",
                    "Suite d’invité locative ($)",
                    "Stations lave-auto",
                    "Salle de rangement à vélos sécurisée",
                    "Eau chaude",
                    "Air climatisé"
                ],
                "ServicesAndOptions": [],
                "ServicesAndOptionsMultiple": [
                    {
                        "Name": "Rangement grillagé sur étage (à partir de)",
                        "Number": 1,
                        "Price": 75
                    },
                    {
                        "Name": "Rangement grillagé souterrain (à partir de)",
                        "Number": 1,
                        "Price": 55
                    }
                ],
                "ServicesAndOptionsPrice": 130,
                "UnitPrice": 2275,
                "Deduction": 0,
                "OtherFees": 0,
                "FinalPrice": 2405
            }
        }
    }
}
{
    "timestamp": "2026-05-04 18:54:17",
    "message": "DEBUG create_visited_units_for_visit - Positive_Aspects analysis",
    "context": {
        "unit": "1250_Le18Juillet-2",
        "requested": [],
        "allowed": [],
        "valid": [],
        "invalid": []
    }
}
{
    "timestamp": "2026-05-04 18:54:17",
    "message": "DEBUG create_visited_units_for_visit - Positive_Aspects analysis",
    "context": {
        "unit": "1026_Le18Juillet-1",
        "requested": [
            "Prix"
        ],
        "allowed": [],
        "valid": [
            "Prix"
        ],
        "invalid": []
    }
}
{
    "timestamp": "2026-05-04 18:54:17",
    "message": "✅ create_all executed",
    "context": {
        "OpportunityId": "006bZ00000Vvn70QAB",
        "VisitId": "a03bZ00000XdNPyQAN",
        "VisitMode": "update",
        "LeadConversion": null,
        "VisitedUnits": [
            {
                "ok": true,
                "unit": "1250_Le18Juillet-2",
                "id": "a01bZ00000NqWY6QAN",
                "http": 201
            },
            {
                "ok": true,
                "unit": "1026_Le18Juillet-1",
                "id": "a01bZ00000NqbO3QAJ",
                "http": 201
            }
        ]
    }
}
{
    "timestamp": "2026-05-04 18:55:18",
    "message": "♻️ Token valide (cache)"
}
{
    "timestamp": "2026-05-04 18:55:20",
    "message": "DEBUG create_all - payload reçu",
    "context": {
        "Agent": {
            "FirstName": "Thomas",
            "LastName": "Raymond",
            "Email": "thomas.raymond@trudel.ca",
            "Job": "Architecte de Solutions "
        },
        "Clients": [
            {
                "FirstName": "Nathan",
                "LastName": "Drake",
                "Email": "Nathan.drake@trudel.ca",
                "Phone": "",
                "Post": ""
            }
        ],
        "Projects_count": 1,
        "GeneralInfo": {
            "Date": "2026.05.04",
            "VisitTime": 46.727352142333984375,
            "Pet": "",
            "UnitsSeeked": [],
            "Comment": ""
        }
    }
}
{
    "timestamp": "2026-05-04 18:55:20",
    "message": "DEBUG create_all - meetingDateTimeIso calculé",
    "context": {
        "MeetingDateTime_input": null,
        "meetingDateTimeIso": null
    }
}
{
    "timestamp": "2026-05-04 18:55:20",
    "message": "✅ lookup_asset_by_building_name - trouvé (exact)",
    "context": {
        "assetId": "02ibZ000002q8npQAA",
        "buildingGroupId": "02ibZ000002pXiLQAU",
        "building": "Le18Juillet-2"
    }
}
{
    "timestamp": "2026-05-04 18:55:20",
    "message": "DEBUG create_all - bâtiment résolu",
    "context": {
        "residentialBuildingName": "Le18Juillet-2",
        "residentialBuildingAssetId": "02ibZ000002q8npQAA",
        "buildingGroupId": "02ibZ000002pXiLQAU"
    }
}
{
    "timestamp": "2026-05-04 18:55:20",
    "message": "DEBUG create_all - recherche ownerId via email agent",
    "context": {
        "agentEmail": "thomas.raymond@trudel.ca",
        "http": 200,
        "res": {
            "totalSize": 1,
            "done": true,
            "records": [
                {
                    "attributes": {
                        "type": "User",
                        "url": "\/services\/data\/v62.0\/sobjects\/User\/005OF000001ng5aYAA"
                    },
                    "Id": "005OF000001ng5aYAA"
                }
            ]
        }
    }
}
{
    "timestamp": "2026-05-04 18:55:20",
    "message": "DEBUG create_all - ownerId retenu",
    "context": {
        "ownerId": "005OF000001ng5aYAA"
    }
}
{
    "timestamp": "2026-05-04 18:55:20",
    "message": "DEBUG find_existing_lead_for_clients - requête Lead",
    "context": {
        "soql": "SELECT Id, FirstName, LastName, Company, Email, Phone, Status, IsConverted, ConvertedOpportunityId\r\n             FROM Lead\r\n             WHERE IsConverted = false\r\n             AND (Email IN ('Nathan.drake@trudel.ca'))\r\n             ORDER BY CreatedDate DESC\r\n             LIMIT 1",
        "emails": [
            "Nathan.drake@trudel.ca"
        ],
        "phones": []
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "DEBUG find_existing_lead_for_clients - résultat requête Lead",
    "context": {
        "http": 200,
        "res": {
            "totalSize": 0,
            "done": true,
            "records": []
        }
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "DEBUG find_existing_lead_for_clients - lead retenu",
    "context": {
        "lead": null
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "DEBUG create_all - lead après recherche",
    "context": {
        "lead": null
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "DEBUG find_existing_opportunity_by_client_email_or_phone - recherche Contact",
    "context": {
        "soql": "SELECT Id FROM Contact\r\n                    WHERE (Email IN ('Nathan.drake@trudel.ca'))\r\n                    ORDER BY CreatedDate DESC LIMIT 1"
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "DEBUG find_existing_opportunity_by_client_email_or_phone - recherche via OCR",
    "context": {
        "contactId": "003bZ00000XdVSLQA3",
        "soql": "SELECT OpportunityId, Opportunity.Building_Group__c\r\n                FROM OpportunityContactRole\r\n                WHERE ContactId = '003bZ00000XdVSLQA3'\r\n                AND Opportunity.IsClosed = false\r\n                AND Opportunity.CreatedDate = LAST_N_DAYS:365\r\n                ORDER BY Opportunity.CreatedDate DESC\r\n                LIMIT 1"
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "DEBUG find_existing_opportunity_by_client_email_or_phone - OCR trouvée",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "foundGroupId": "02ibZ000002pXiLQAU"
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "✅ Groupe d'immeuble identique — Opportunity réutilisée",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "buildingGroupId": "02ibZ000002pXiLQAU"
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "✅ Dédup Opportunity trouvée par email\/téléphone — réutilisation",
    "context": {
        "oppId": "006bZ00000Vvn70QAB"
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "✅ Opportunity mise à jour avec bâtiment\/groupe",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "payload": {
            "Residential_Building__c": "02ibZ000002q8npQAA",
            "Building_Group__c": "02ibZ000002pXiLQAU"
        }
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "DEBUG create_all - aucun lead trouvé, passage direct au flow classique",
    "context": {
        "clients": [
            {
                "FirstName": "Nathan",
                "LastName": "Drake",
                "Email": "Nathan.drake@trudel.ca",
                "Phone": "",
                "Post": ""
            }
        ]
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "DEBUG create_all - visitPayload final",
    "context": {
        "visitPayload": {
            "Opportunity__c": "006bZ00000Vvn70QAB",
            "Assign_to__c": "005OF000001ng5aYAA",
            "Meeting_Date_Time__c": "2026-05-04T18:55:21Z",
            "Meeting_Notes__c": "",
            "Visit_Duration__c": 1
        }
    }
}
{
    "timestamp": "2026-05-04 18:55:21",
    "message": "ℹ️ upsert_visit - Visit__c existante aujourd'hui — réutilisation",
    "context": {
        "oppId": "006bZ00000Vvn70QAB",
        "visitId": "a03bZ00000XdNPyQAN"
    }
}
{
    "timestamp": "2026-05-04 18:55:22",
    "message": "DEBUG create_all - résultat upsert Visit__c",
    "context": {
        "okVisit": true,
        "visitMode": "update",
        "visitId": "a03bZ00000XdNPyQAN",
        "visitHttp": 200,
        "visitRes": {
            "id": "a03bZ00000XdNPyQAN",
            "updated": true
        }
    }
}
{
    "timestamp": "2026-05-04 18:55:22",
    "message": "DEBUG create_all - visitedUnits source finale",
    "context": {
        "visitedUnits": [
            "1150_Le18Juillet-2",
            "330_Le18Juillet-1"
        ]
    }
}
{
    "timestamp": "2026-05-04 18:55:22",
    "message": "DEBUG create_all - defaultVURecordTypeId",
    "context": {
        "defaultVURecordTypeId": "0128a000000tkjSAAQ"
    }
}
{
    "timestamp": "2026-05-04 18:55:22",
    "message": "DEBUG create_all - estimatesByUnit",
    "context": {
        "estimatesByUnit": {
            "330": {
                "Unit": "330",
                "ServicesAndOptionsIncluded": [
                    "Piscine extérieure au toit",
                    "Salle de mise en forme",
                    "Cuisine d’été",
                    "Salle de réception ($)",
                    "Suite d’invité locative ($)",
                    "Stations lave-auto",
                    "Salle de rangement à vélos sécurisée",
                    "Eau chaude",
                    "Air climatisé"
                ],
                "ServicesAndOptions": [],
                "ServicesAndOptionsMultiple": [
                    {
                        "Name": "Location borne de recharge",
                        "Number": 1,
                        "Price": 35
                    },
                    {
                        "Name": "Rangement grillagé souterrain (à partir de)",
                        "Number": 1,
                        "Price": 55
                    }
                ],
                "ServicesAndOptionsPrice": 90,
                "UnitPrice": 3035,
                "Deduction": 0,
                "OtherFees": 0,
                "FinalPrice": 3125
            }
        }
    }
}
{
    "timestamp": "2026-05-04 18:55:22",
    "message": "DEBUG create_visited_units_for_visit - Positive_Aspects analysis",
    "context": {
        "unit": "1150_Le18Juillet-2",
        "requested": [],
        "allowed": [],
        "valid": [],
        "invalid": []
    }
}
{
    "timestamp": "2026-05-04 18:55:22",
    "message": "DEBUG create_visited_units_for_visit - Positive_Aspects analysis",
    "context": {
        "unit": "330_Le18Juillet-1",
        "requested": [
            "Prix"
        ],
        "allowed": [],
        "valid": [
            "Prix"
        ],
        "invalid": []
    }
}
{
    "timestamp": "2026-05-04 18:55:23",
    "message": "✅ create_all executed",
    "context": {
        "OpportunityId": "006bZ00000Vvn70QAB",
        "VisitId": "a03bZ00000XdNPyQAN",
        "VisitMode": "update",
        "LeadConversion": null,
        "VisitedUnits": [
            {
                "ok": true,
                "unit": "1150_Le18Juillet-2",
                "id": "a01bZ00000NqV7SQAV",
                "http": 201
            },
            {
                "ok": true,
                "unit": "330_Le18Juillet-1",
                "id": "a01bZ00000NqaAGQAZ",
                "http": 201
            }
        ]
    }
}
{
    "timestamp": "2026-05-04 19:01:01",
    "message": "♻️ Token valide (cache)"
}
{
    "timestamp": "2026-05-04 19:01:03",
    "message": "♻️ Token valide (cache)"
}
{
    "timestamp": "2026-05-04 19:01:04",
    "message": "♻️ Token valide (cache)"
}
{
    "timestamp": "2026-05-04 19:01:07",
    "message": "♻️ Token valide (cache)"
}
{
    "timestamp": "2026-05-04 19:01:10",
    "message": "♻️ Token valide (cache)"
}
{
    "timestamp": "2026-05-04 19:01:12",
    "message": "♻️ Token valide (cache)"
}
