package com.atlassian.bitbucket.scm.cache.rest;

import com.atlassian.bitbucket.rest.RestMapEntity;
import com.atlassian.util.contentcache.CacheEntryStatistics;
import org.codehaus.jackson.map.annotate.JsonSerialize;

@JsonSerialize
public class RestCacheEntryStatistics extends RestMapEntity {

    private static final String CREATED = "created";
    private static final String KEY = "key";
    private static final String SIZE = "size";
    private static final String LAST_ACCESSED = "last-accessed";
    private static final String HITS = "hits";

    public RestCacheEntryStatistics(CacheEntryStatistics stats) {
        put(KEY, stats.getKey());
        put(CREATED, stats.getCreatedDate().toString());
        put(LAST_ACCESSED, stats.getLastAccessedDate().toString());
        put(HITS, stats.getHits());
        put(SIZE, stats.getSize());
    }
}
