package com.nifty.cloud.ncs.service;

/**
 * ニフクラストレージクライアントで使用される共通HTTPヘッダを定義するクラスです。
 */
public class StorageHeadersImpl implements StorageHeaders
{
    /*
     * Standard HTTP Headers
     */
	public static final String CONTENT_LENGTH					= "Content-Length";
	public static final String CONTENT_ENCODING					= "Content-Encoding";
	public static final String CONTENT_MD5						= "Content-MD5";
	public static final String CONTENT_SHA256					= "Content-SHA256";
	public static final String CONTENT_TYPE						= "Content-Type";
	public static final String CACHE_CONTROL					= "Cache-Control";
	public static final String CONTENT_DISPOSITION				= "Content-Disposition";

	public static final String DATE								= "Date";
	public static final String ETAG								= "ETag";
	public static final String LAST_MODIFIED					= "Last-Modified";
	public static final String SERVER							= "Server";
	public static final String USER_AGENT						= "User-Agent";

	/** Niftyヘッダの接頭辞： x-nifty- */
	public static String NIFTY_PREFIX							= "x-nifty-";

	/** 要求IDを示す応答ヘッダ */
	public static String REQUEST_ID								= "x-nifty-request-id";

	/** 拡張要求IDを示す応答ヘッダ */
	public static String EXTENDED_REQUEST_ID					= "x-nifty-id-2";

    /** If-Modified-Sinceヘッダ */
	public static final String GET_OBJECT_IF_MODIFIED_SINCE		= "If-Modified-Since";

	/** If-Unmodified-Sinceヘッダ */
	public static final String GET_OBJECT_IF_UNMODIFIED_SINCE	= "If-Unmodified-Since";

	/** If-Matchヘッダ */
	public static final String GET_OBJECT_IF_MATCH				= "If-Match";

	/** If-None-Matchヘッダ */
	public static final String GET_OBJECT_IF_NONE_MATCH			= "If-None-Match";

	/** ユーザが設定するメタデータヘッダの接頭辞: x-nifty-meta- */
	public static String NIFTY_USER_METADATA_PREFIX				= "x-nifty-meta-";

	/** Rangeヘッダ */
	public static final String RANGE							= "Range";

	/*
	 * CopyObject Headers
	 */
	public static String COPY_SOURCE							= "x-nifty-copy-source";

	/*
	 *  Encryption Headers
	 */
	public static String ENCRYPTION_KEY							= "x-nifty-key";
	public static String ENCRYPTION_IV							= "x-nifty-iv";
	public static String ENCRYPTION_MATERIALS_DESCRIPTION		= "x-nifty-matdesc";
	public static final String ENCRYPTION_INSTRUCTION_FILE		= "crypto-instr-file";

	/**
	 * HTTPヘッダの接頭辞を設定します。
	 *
	 * @param prefix
	 * 			HTTPヘッダ接頭辞
	 */
	public static void setPrefix(String prefix)
	{
		if (prefix.endsWith("-") == false) {
			prefix = prefix + "-";
		}
		StorageHeadersImpl.NIFTY_PREFIX = prefix;

		StorageHeadersImpl.REQUEST_ID = prefix + "request-id";
		StorageHeadersImpl.EXTENDED_REQUEST_ID = prefix + "id-2";
		StorageHeadersImpl.NIFTY_USER_METADATA_PREFIX = prefix + "meta-";

		StorageHeadersImpl.COPY_SOURCE = prefix + "copy-source";

		StorageHeadersImpl.ENCRYPTION_KEY = prefix + "key";
		StorageHeadersImpl.ENCRYPTION_IV = prefix + "iv";
		StorageHeadersImpl.ENCRYPTION_MATERIALS_DESCRIPTION = prefix + "matdesc";
	}
}
