<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./schema.xsd">
    <changeset id="PHYS-4901_distribution_profiles_and_roles:1" author="yostapyuk" run-on-change="true">
        <cypherquery>
        <![CDATA[
            MATCH (identity:Identity {id: 'f21f6490-a962-45be-81db-39d7a7eee99b'})
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (profile:Profile {
                profileId: (increment.id-1),
                profileType: 'DistributionProfile',
                profileName: 'Tricia Arnold',
                uuid: apoc.create.uuid(),
                roles: ['deliver_physical_audio'],
                fullCatalogAccess: true
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
        ]]>
        </cypherquery>
    </changeset>

    <changeset id="PHYS-4901_distribution_profiles_and_roles:2" author="yostapyuk" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {id: 'a5d9bab6-7909-465b-b86b-6c0971fbdc42'})
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (profile:Profile {
                profileId: (increment.id-1),
                profileType: 'DistributionProfile',
                profileName: 'Daniel Sopp',
                uuid: apoc.create.uuid(),
                roles: ['deliver_physical_audio'],
                fullCatalogAccess: true
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
        ]]>
        </cypherquery>
    </changeset>

    <changeset id="PHYS-4901_distribution_profiles_and_roles:3" author="yostapyuk" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {id: 'd68ada8a-1ebd-43e4-b374-2c0c88d3b081'})
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (profile:Profile {
                profileId: (increment.id-1),
                profileType: 'DistributionProfile',
                profileName: 'Paul Raimer',
                uuid: apoc.create.uuid(),
                roles: ['deliver_physical_audio'],
                fullCatalogAccess: true
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
        ]]>
        </cypherquery>
    </changeset>

    <changeset id="PHYS-4901_distribution_profiles_and_roles:4" author="yostapyuk" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {id: '9d72c8ff-eeae-4b18-9b51-c5f53bbb8364'})
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (profile:Profile {
                profileId: (increment.id-1),
                profileType: 'DistributionProfile',
                profileName: 'Sam Relleen',
                uuid: apoc.create.uuid(),
                roles: ['deliver_physical_audio'],
                fullCatalogAccess: true
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
        ]]>
        </cypherquery>
    </changeset>

    <changeset id="PHYS-4901_distribution_profiles_and_roles:5" author="yostapyuk" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {id: 'd6533e33-c7bb-4c8d-9511-7ee2143097cf'})
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (profile:Profile {
                profileId: (increment.id-1),
                profileType: 'DistributionProfile',
                profileName: 'Ben South',
                uuid: apoc.create.uuid(),
                roles: ['deliver_physical_audio'],
                fullCatalogAccess: true
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
        ]]>
        </cypherquery>
    </changeset>

    <changeset id="PHYS-4901_distribution_profiles_and_roles:6" author="yostapyuk" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {id: 'fd09c446-bae4-4fd8-94d4-cfec12967834'})
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (profile:Profile {
                profileId: (increment.id-1),
                profileType: 'DistributionProfile',
                profileName: 'Liz Snair',
                uuid: apoc.create.uuid(),
                roles: ['deliver_physical_audio'],
                fullCatalogAccess: true
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
        ]]>
        </cypherquery>
    </changeset>

    <changeset id="PHYS-4901_distribution_profiles_and_roles:7" author="yostapyuk" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {id: '63e294b0-e2b0-4597-ab6e-107ee71ca053'})
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (profile:Profile {
                profileId: (increment.id-1),
                profileType: 'DistributionProfile',
                profileName: 'Daniel Clark',
                uuid: apoc.create.uuid(),
                roles: ['deliver_physical_audio'],
                fullCatalogAccess: true
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
        ]]>
        </cypherquery>
    </changeset>
    <changeset id="PHYS-4901_distribution_profiles_and_roles:8" author="yostapyuk" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {id: 'f1a5d912-9072-4e3e-8af3-a4ba5542aebb'})
            MERGE (increment:IncrementId {nodeName: 'Profile'})
                ON CREATE SET increment.id = 2
                ON MATCH SET increment.id = increment.id + 1
            CREATE (profile:Profile {
                profileId: (increment.id-1),
                profileType: 'DistributionProfile',
                profileName: 'Govind Singh',
                uuid: apoc.create.uuid(),
                roles: ['deliver_physical_audio'],
                fullCatalogAccess: true
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
        ]]>
        </cypherquery>
    </changeset>
    
    <changeset id="PHYS-4901_distribution_profiles_and_roles:9" author="yostapyuk" run-on-change="true">
        <cypherquery>
        <![CDATA[
            MATCH (i:Identity)-[:HAS_PROFILE]->(p:Profile {profileType: "DistributionProfile"}) 
            WHERE i.email in [
                'tdenkinger@theorchard.com',
                'sduberg@theorchard.com'
            ]
            SET p.roles = p.roles + 'deliver_physical_audio'
            RETURN i.email, p.roles
        ]]>
        </cypherquery>
    </changeset>
</changelog>
