package org.wso2.carbon.device.mgt.ios.payload.operation;

import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.device.mgt.ios.payload.dto.PayloadProperties;

public class PolicyOperations {

    private static final String PAYLOAD_NAME = "Policy Bundle";
    private static final String PAYLOAD_DESCRIPTION = "Policy Configurations for %s";

    public PayloadProperties generatePayloadProperties(String UUID) {

        PayloadProperties payloadProperties = new PayloadProperties();
        //TODO handle proper tenant here
        String tenantName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain();
        payloadProperties.setTenantName(tenantName);
        payloadProperties.setPayloadIdentifier(UUID);
        payloadProperties.setPayloadDisplayName(PAYLOAD_NAME);
        //TODO handle proper tenant here
        payloadProperties.setPayloadDescription(String.format(PAYLOAD_DESCRIPTION, tenantName));
        //TODO make this a configuration
        payloadProperties.setPayloadRemoveDisallowed(true);

        return payloadProperties;
    }
}
