<?xml version="1.0" encoding="UTF-8" ?>

<xsd:schema xmlns="https://sentry.io/schema/dic/sentry-symfony"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="https://sentry.io/schema/dic/sentry-symfony"
            elementFormDefault="qualified">

    <xsd:element name="config" type="config" />

    <xsd:complexType name="config">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element name="options" type="options" minOccurs="0" maxOccurs="1" />
            <xsd:element name="messenger" type="messenger" minOccurs="0" maxOccurs="1" />
            <xsd:element name="tracing" type="tracing" minOccurs="0" maxOccurs="1" />
        </xsd:choice>

        <xsd:attribute name="register-error-listener" type="xsd:boolean" />
        <xsd:attribute name="register-error-handler" type="xsd:boolean" />
        <xsd:attribute name="transport-factory" type="xsd:string" />
        <xsd:attribute name="dsn" type="xsd:string" />
        <xsd:attribute name="logger" type="xsd:string" />
    </xsd:complexType>

    <xsd:complexType name="options">
        <xsd:sequence>
            <xsd:element name="integration" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="trace-propagation-target" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="prefix" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="tag" type="tag" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="in-app-exclude" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="in-app-include" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="class-serializer" type="class-serializer" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="ignore-exception" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="ignore-transaction" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="data-collection" type="data-collection" minOccurs="0" maxOccurs="1" />
        </xsd:sequence>

        <xsd:attribute name="default-integrations" type="xsd:boolean" />
        <xsd:attribute name="sample-rate" type="xsd:float" />
        <xsd:attribute name="enable-tracing" type="xsd:boolean" />
        <xsd:attribute name="enable-logs" type="xsd:boolean" />
        <xsd:attribute name="log-flush-threshold" type="xsd:integer" />
        <xsd:attribute name="traces-sample-rate" type="xsd:float" />
        <xsd:attribute name="profiles-sample-rate" type="xsd:float" />
        <xsd:attribute name="traces-sampler" type="xsd:string" />
        <xsd:attribute name="attach-stacktrace" type="xsd:boolean" />
        <xsd:attribute name="attach-metric-code-locations" type="xsd:boolean" />
        <xsd:attribute name="context-lines" type="xsd:integer" />
        <xsd:attribute name="enable-compression" type="xsd:boolean" />
        <xsd:attribute name="environment" type="xsd:string" />
        <xsd:attribute name="logger" type="xsd:string" />
        <xsd:attribute name="spotlight" type="xsd:boolean" />
        <xsd:attribute name="spotlight-url" type="xsd:string" />
        <xsd:attribute name="release" type="xsd:string" />
        <xsd:attribute name="org-id" type="xsd:integer" />
        <xsd:attribute name="server-name" type="xsd:string" />
        <xsd:attribute name="before-send" type="xsd:string" />
        <xsd:attribute name="before-send-transaction" type="xsd:string" />
        <xsd:attribute name="before-send-check-in" type="xsd:string" />
        <xsd:attribute name="before-send-metrics" type="xsd:string" />
        <xsd:attribute name="before-send-log" type="xsd:string" />
        <xsd:attribute name="error-types" type="xsd:string" />
        <xsd:attribute name="max-breadcrumbs" type="xsd:integer" />
        <xsd:attribute name="before-breadcrumb" type="xsd:string" />
        <xsd:attribute name="send-default-pii" type="xsd:boolean" />
        <xsd:attribute name="max-value-length" type="xsd:integer" />
        <xsd:attribute name="transport" type="xsd:string" />
        <xsd:attribute name="http-client" type="xsd:string" />
        <xsd:attribute name="http-proxy" type="xsd:string" />
        <xsd:attribute name="http-proxy-authentication" type="xsd:string" />
        <xsd:attribute name="http-connect-timeout" type="xsd:integer" />
        <xsd:attribute name="http-timeout" type="xsd:integer" />
        <xsd:attribute name="http-ssl-verify-peer" type="xsd:boolean" />
        <xsd:attribute name="http-compression" type="xsd:boolean" />
        <xsd:attribute name="capture-silenced-errors" type="xsd:boolean" />
        <xsd:attribute name="max-request-body-size" type="max-request-body-size" />
        <xsd:attribute name="strict-trace-continuation" type="xsd:boolean" />
    </xsd:complexType>

    <xsd:complexType name="tag">
        <xsd:simpleContent>
            <xsd:extension base="xsd:string">
                <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType>

    <xsd:complexType name="class-serializer">
        <xsd:simpleContent>
            <xsd:extension base="xsd:string">
                <xsd:attribute name="class" type="xsd:string" use="required" />
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType>

    <xsd:simpleType name="max-request-body-size">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="none" />
            <xsd:enumeration value="small" />
            <xsd:enumeration value="medium" />
            <xsd:enumeration value="always" />
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="data-collection">
        <xsd:choice minOccurs="0" maxOccurs="unbounded">
            <xsd:element name="cookies" type="data-collection-key-value" minOccurs="0" maxOccurs="1" />
            <xsd:element name="http-headers" type="data-collection-http-headers" minOccurs="0" maxOccurs="1" />
            <xsd:element name="http-body" type="data-collection-http-body" minOccurs="0" maxOccurs="unbounded" />
            <!-- An empty element disables the collection of all HTTP bodies -->
            <xsd:element name="http-bodies" minOccurs="0" maxOccurs="1">
                <xsd:complexType />
            </xsd:element>
            <xsd:element name="url-query-params" type="data-collection-key-value" minOccurs="0" maxOccurs="1" />
            <xsd:element name="gen-ai" type="data-collection-gen-ai" minOccurs="0" maxOccurs="1" />
            <xsd:element name="stack-frame-variables" type="data-collection-key-value" minOccurs="0" maxOccurs="1" />
        </xsd:choice>

        <xsd:attribute name="user-info" type="xsd:boolean" />
        <xsd:attribute name="database-query-data" type="xsd:boolean" />
        <xsd:attribute name="queues" type="xsd:boolean" />
        <xsd:attribute name="stack-frame-variables" type="xsd:boolean" />
        <xsd:attribute name="frame-context-lines" type="xsd:nonNegativeInteger" />
    </xsd:complexType>

    <xsd:complexType name="data-collection-key-value">
        <xsd:sequence>
            <xsd:element name="term" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>

        <xsd:attribute name="mode" type="data-collection-mode" />
    </xsd:complexType>

    <xsd:complexType name="data-collection-http-headers">
        <!-- Either terms and a mode for both directions, or a request and response element -->
        <xsd:sequence>
            <xsd:element name="term" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
            <xsd:element name="request" type="data-collection-key-value" minOccurs="0" maxOccurs="1" />
            <xsd:element name="response" type="data-collection-key-value" minOccurs="0" maxOccurs="1" />
        </xsd:sequence>

        <xsd:attribute name="mode" type="data-collection-mode" />
    </xsd:complexType>

    <xsd:complexType name="data-collection-gen-ai">
        <xsd:attribute name="inputs" type="xsd:boolean" />
        <xsd:attribute name="outputs" type="xsd:boolean" />
    </xsd:complexType>

    <xsd:simpleType name="data-collection-mode">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="off" />
            <xsd:enumeration value="denyList" />
            <xsd:enumeration value="allowList" />
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:simpleType name="data-collection-http-body">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="incomingRequest" />
            <xsd:enumeration value="outgoingRequest" />
            <xsd:enumeration value="incomingResponse" />
            <xsd:enumeration value="outgoingResponse" />
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="messenger">
        <xsd:attribute name="enabled" type="xsd:boolean" />
        <xsd:attribute name="capture-soft-fails" type="xsd:boolean" />
        <xsd:attribute name="isolate-breadcrumbs-by-message" type="xsd:boolean" />
        <xsd:attribute name="isolate-context-by-message" type="xsd:boolean" />
    </xsd:complexType>

    <xsd:complexType name="tracing">
        <xsd:choice maxOccurs="unbounded">
            <xsd:element name="dbal" type="tracing-dbal" minOccurs="0" maxOccurs="1" />
            <xsd:element name="twig" type="tracing-twig" minOccurs="0" maxOccurs="1" />
            <xsd:element name="cache" type="tracing-cache" minOccurs="0" maxOccurs="1" />
            <xsd:element name="console" type="tracing-console" minOccurs="0" maxOccurs="1" />
            <xsd:element name="http-client" type="tracing-http-client" minOccurs="0" maxOccurs="1" />
        </xsd:choice>

        <xsd:attribute name="enabled" type="xsd:boolean" default="true"/>
    </xsd:complexType>

    <xsd:complexType name="tracing-dbal">
        <xsd:sequence maxOccurs="unbounded">
            <xsd:element name="connection" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>

        <xsd:attribute name="enabled" type="xsd:boolean" />
        <xsd:attribute name="ignore-prepare-spans" type="xsd:boolean" />
    </xsd:complexType>

    <xsd:complexType name="tracing-twig">
        <xsd:attribute name="enabled" type="xsd:boolean" />
    </xsd:complexType>

    <xsd:complexType name="tracing-cache">
        <xsd:attribute name="enabled" type="xsd:boolean" />
    </xsd:complexType>

    <xsd:complexType name="tracing-console">
        <xsd:sequence maxOccurs="unbounded">
            <xsd:element name="excluded-command" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="tracing-http-client">
        <xsd:attribute name="enabled" type="xsd:boolean" />
    </xsd:complexType>
</xsd:schema>
