class StorageBillingMapper extends AbstractEntityMapper<StorageBillingInfo> {

    @Override
    public XContentBuilder map(final EntityContainer<StorageBillingInfo> container) {
        try (XContentBuilder jsonBuilder = XContentFactory.jsonBuilder()) {
            final StorageBillingInfo billingInfo = container.getEntity();
            final AbstractDataStorage storage = billingInfo.getEntity();
            jsonBuilder
                .startObject()
                .field(DOC_TYPE_FIELD, documentType.name())
                .field("storage_id", storage.getId())
                .field("resource_type", billingInfo.getResourceType())
                .field("cloudRegionId", billingInfo.getRegionId())
                .field("provider", storage.getType())
                .field("storage_type", billingInfo.getStorageType())
                .field("usage_bytes", billingInfo.getUsageBytes())
                .field("cost", billingInfo.getCost())
                .field("created_date", billingInfo.getDate());
            buildUserContent(container.getOwner(), jsonBuilder);
            jsonBuilder.endObject();
            return jsonBuilder;
        } catch (IOException e) {
            throw new IllegalArgumentException("Failed to create elasticsearch document for data storage: ", e);
        }
    }

}