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

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.mgt.ios.payload.exception.ProfileConfigurationException;

@ApiModel(value = "AppStoreApplication",
        description = "Information related to App store application.")
public class AppStoreApplication extends CommandOperation {

    @ApiModelProperty(name = "identifier",
            value = "Device identifier.", required = true)
    private String identifier;
    @ApiModelProperty(name = "iTunesStoreID",
            value = "Id of the iTune store.", required = true)
    private Integer iTunesStoreID;
    @ApiModelProperty(name = "removeAppUponMDMProfileRemoval",
            value = "Remove or not status of the MDM profile.", required = true)
    private Boolean removeAppUponMDMProfileRemoval;
    @ApiModelProperty(name = "preventBackupOfAppData",
            value = "Prevent status of the App data backup.", required = true)
    private Boolean preventBackupOfAppData;

    @Override
    public void validateRequest() throws ProfileConfigurationException {
        if (iTunesStoreID == null || iTunesStoreID.intValue() == 0) {
            throw new ProfileConfigurationException(
                    "iTunes store id is not set for app store application installation");
        }
    }

    public String getIdentifier() {
        return identifier;
    }

    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    public Integer getiTunesStoreID() {
        return iTunesStoreID;
    }

    public void setiTunesStoreID(Integer iTunesStoreID) {
        this.iTunesStoreID = iTunesStoreID;
    }

    public Boolean getRemoveAppUponMDMProfileRemoval() {
        return removeAppUponMDMProfileRemoval;
    }

    public void setRemoveAppUponMDMProfileRemoval(Boolean removeAppUponMDMProfileRemoval) {
        this.removeAppUponMDMProfileRemoval = removeAppUponMDMProfileRemoval;
    }

    public Boolean getPreventBackupOfAppData() {
        return preventBackupOfAppData;
    }

    public void setPreventBackupOfAppData(Boolean preventBackupOfAppData) {
        this.preventBackupOfAppData = preventBackupOfAppData;
    }
}
