package org.wso2.carbon.device.mgt.ios.services;

import io.swagger.annotations.ApiParam;
import org.wso2.carbon.device.mgt.ios.dep.beans.DeviceProfile;
import org.wso2.carbon.device.mgt.ios.dep.beans.ProfileWithDevices;

import javax.validation.constraints.Size;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;

/**
 * iOS COPE device enrollment REST-API implementation Interface.
 */
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public interface DEPService {

    @GET
    @Path("/account-details")
    Response getAccountDetails();

    @GET
    @Path("/devices")
    Response getDevices(
            @ApiParam(
                    name = "limit",
                    value = "The maximum number of devices to return such as 100, 200.",
                    required = false)
            @Size(max = 1000)
            @QueryParam("limit")
                    int limit,
            @ApiParam(
                    name = "cursor",
                    value = "A hex string that represents the starting position for a request. " +
                            "This is used for retrieving the list of devices that have been added" +
                            " or removed since a previous request such as 1ac73329f75815.",
                    required = false)
            @QueryParam("cursor")
                    String cursor);

    @GET
    @Path("/devices/sync")
    Response syncDevices(
            @ApiParam(
                    name = "limit",
                    value = "The maximum number of devices to return such as 100, 200.",
                    required = false)
            @Size(max = 1000)
            @QueryParam("limit")
                    int limit,
            @ApiParam(
                    name = "cursor",
                    value = "A hex string that represents the starting position for a request. " +
                            "This is used for retrieving the list of devices that have been added" +
                            " or removed since a previous request such as 1ac73329f75815.",
                    required = true)
            @QueryParam("cursor")
                    String cursor);

    @GET
    @Path("/devices/{deviceSerial}")
    Response getDevice(
            @ApiParam(
                    name = "deviceSerial",
                    value = "Strings containing device serial number such as B7CJ500QF1MA.",
                    required = true)
            @PathParam("deviceSerial")
                    String deviceSerial);

    @POST
    @Path("/devices/profile")
    Response createProfile(
            @ApiParam(
                    name = "deviceProfile",
                    value = "JSON object containing the details required create Apple DEP profile",
                    required = true)
                    DeviceProfile deviceProfile);

    @POST
    @Path("/devices/assign-profile")
    Response assignProfile(
            @ApiParam(
                    name = "profileWithDevices",
                    value = "JSON object containing the details required to assign " +
                            "profile to devices.",
                    required = true)
                    ProfileWithDevices profileWithDevices);

    @GET
    @Path("/profile/{profileId}")
    Response getProfile(
            @ApiParam(
                    name = "profileId",
                    value = "String containing the ID of the profile to be retrieved.",
                    required = true)
            @PathParam("profileId")
                    String profileId);

    @POST
    @Path("/devices/remove-profile")
    Response removeProfile(
            @ApiParam(
                    name = "deviceSerialNumbers",
                    value = "List of device serials on which the Apple DEP profile " +
                            "needs to be removed.",
                    required = true)
                    List<String> deviceSerialNumbers);

    @POST
    @Path("/devices/disown/")
    Response disownDevices(
            @ApiParam(
                    name = "deviceSerialNumbers",
                    value = "List of device serial numbers which needs needs to be disowned " +
                            "from the Apple DEP portal.",
                    required = true)
                    List<String> deviceSerialNumbers);
}
