<?xml version="1.0" encoding="UTF-8"?>
<changelog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./schema.xsd">

     <changeset id="WAR-640_add_moneyhub_profiles_and_vendor_accesses:1" author="epohrebna" run-on-change="true">
        <cypherquery>
            <![CDATA[

            MATCH (identity:Identity {email: 'kgoyal@theorchard.com'})
            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: 'MoneyhubProfile',
                profileName: identity.name,
                brand: identity.defaultBrand,
                fullCatalogAccess: true,
                roles: ['accounting'],
                uuid: apoc.create.uuid()
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
            WITH profile
            MATCH (vendor:Vendor {id: '*'})
            MERGE (profile)-[:HAS_ADMIN_ACCESS_TO]->(vendor)

            ]]>
        </cypherquery>
    </changeset>

     <changeset id="WAR-640_add_moneyhub_profiles_and_vendor_accesses:2" author="epohrebna" run-on-change="true">
        <cypherquery>
            <![CDATA[

            MATCH (identity:Identity {email: 'ncieslak@theorchard.com'})
            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: 'MoneyhubProfile',
                profileName: identity.name,
                brand: identity.defaultBrand,
                fullCatalogAccess: true,
                roles: ['accounting'],
                uuid: apoc.create.uuid()
            })
            MERGE (identity)-[:HAS_PROFILE]->(profile)
            WITH profile
            MATCH (vendor:Vendor {id: '*'})
            MERGE (profile)-[:HAS_ADMIN_ACCESS_TO]->(vendor)

            ]]>
        </cypherquery>
    </changeset>

    <changeset id="WAR-640_add_moneyhub_profiles_and_vendor_accesses:3" author="epohrebna" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {email: 'praimer@theorchard.com'})-[:HAS_PROFILE]->(p:Profile {profileType: 'MoneyhubProfile'})
            SET p.fullCatalogAccess = true
            ]]>
        </cypherquery>
    </changeset>

    <changeset id="WAR-640_add_moneyhub_profiles_and_vendor_accesses:4" author="epohrebna" run-on-change="true">
        <cypherquery>
            <![CDATA[
            MATCH (identity:Identity {email: 'praimer@theorchard.com'})-[:HAS_PROFILE]->(profile:Profile {profileType: 'MoneyhubProfile'}),
                (vendor:Vendor {id: '*'})
            MERGE (profile)-[:HAS_ADMIN_ACCESS_TO]->(vendor)
            ]]>
        </cypherquery>
    </changeset>

</changelog>
