package com.kryptnostic.storage.v2.models;

import java.util.UUID;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Optional;
import com.kryptnostic.v2.constants.Names;
import com.kryptnostic.v2.storage.types.TypeUUIDs;

public class CreateMetadataObjectRequest extends CreateObjectRequest {
    private final byte[] address;

    public CreateMetadataObjectRequest( byte[] address ) {
        super(
                TypeUUIDs.INDEX_METADATA,
                Optional.<UUID> absent(),
                Optional.<UUID> absent(),
                Optional.<Boolean> absent(),
                Optional.<Boolean> absent(),
                Optional.<Boolean> absent() );
        this.address = address;
    }

    @JsonCreator
    public CreateMetadataObjectRequest(
            @JsonProperty( Names.ADDRESS_FIELD ) byte[] address,
            @JsonProperty( Names.PARENT_OBJECT_ID_FIELD ) Optional<UUID> parentObjectId,
            @JsonProperty( Names.ID_FIELD ) Optional<UUID> objectId,
            @JsonProperty( Names.INHERITING_OWNERSHIP_FIELD ) Optional<Boolean> inheritOwnership,
            @JsonProperty( Names.INHERITING_CRYPTO_SERVICE_FIELD ) Optional<Boolean> inheritCryptoService,
            @JsonProperty( Names.LOCKED_FIELD ) Optional<Boolean> locked ) {
        super( TypeUUIDs.INDEX_METADATA, parentObjectId, objectId, inheritOwnership, inheritCryptoService, locked );
        this.address = address;
    }

    @JsonProperty( Names.ADDRESS_FIELD )
    public byte[] getAddress() {
        return address;
    }
}

@@ -41,32 +41,8 @@
 s;%0A%0A
-import java.util.UUID;%0A%0A
 impo
@@ -90,16 +90,16 @@
 reator;%0A
+
 import c
@@ -519,36 +519,50 @@
       Optional.%3C
-UUID
+VersionedObjectKey
 %3E absent(),%0A    
@@ -583,20 +583,34 @@
 tional.%3C
-UUID
+VersionedObjectKey
 %3E absent
@@ -978,20 +978,34 @@
 ptional%3C
-UUID
+VersionedObjectKey
 %3E parent
@@ -1067,20 +1067,34 @@
 ptional%3C
-UUID
+VersionedObjectKey
 %3E object
@@ -1302,16 +1302,16 @@
 ervice,%0A
+
         
@@ -1374,17 +1374,16 @@
 %3E locked
- 
 ) %7B%0A    

update createMetadataObjectRequest