// Extracted from: Spotify 1.2.52.442 (windows)

syntax = "proto3";

package spotify.offline.proto;

import "google/protobuf/timestamp.proto";
import "offline.proto";

option optimize_for = CODE_SIZE;

message ListDevicesRequest {
    string user_id = 1;
}

message ListDevicesResponse {
    repeated Device devices = 1;
}

message PutDeviceRequest {
    string user_id = 1;

    Body body = 2;
    message Body {
        Device device = 1;
    }
}

message BasicDeviceRequest {
    DeviceKey key = 1;
}

message GetDeviceResponse {
    Device device = 1;
}

message RemoveDeviceRequest {
    DeviceKey key = 1;
    bool is_force_remove = 2;
}

message OfflineEnableDeviceRequest {
    message Body {
      bool auto_opc = 1;
    }

    DeviceKey key = 1;
    Body body = 2;
    string name = 9;
    int32 platform = 7;
    string client_id = 8;
}

message OfflineEnableDeviceResponse {
    enum StatusCode {
      UNKNOWN = 0;
      OK = 1;
      DEVICE_LIMIT_REACHED = 2;
    }

    Restrictions restrictions = 1;
    StatusCode status_code = 2;
}

message ListResourcesResponse {
    repeated Resource resources = 1;
    google.protobuf.Timestamp server_time = 2;
}

message WriteResourcesRequest {
    DeviceKey key = 1;

    Body body = 2;
    message Body {
        repeated ResourceOperation operations = 1;
        string source_device_id = 2;
        string source_cache_id = 3;
    }
}

message ResourcesUpdate {
    string source_device_id = 1;
    string source_cache_id = 2;
}

message DeltaResourcesRequest {
    DeviceKey key = 1;

    Body body = 2;
    message Body {
        google.protobuf.Timestamp last_known_server_time = 1;
    }
}

message DeltaResourcesResponse {
    bool delta_update_possible = 1;
    repeated ResourceOperation operations = 2;
    google.protobuf.Timestamp server_time = 3;
}

message GetResourceRequest {
    DeviceKey key = 1;
    string uri = 2;
}

message GetResourceResponse {
    Resource resource = 1;
}

message WriteResourcesDetailsRequest {
    DeviceKey key = 1;

    Body body = 2;
    message Body {
        repeated Resource resources = 1;
    }
}

message GetResourceForDevicesRequest {
    string user_id = 1;
    string uri = 2;
}

message GetResourceForDevicesResponse {
    repeated Device devices = 1;
    repeated ResourceForDevice resources = 2;
}

message ListDevicesWithResourceRequest {
    message Body {
        string uri = 1;
    }

    string user_id = 1;
    string username = 2;
    Body body = 3;
}

message ListDevicesWithResourceResponse {
    message DeviceWithResource {
        Device device = 1;
        bool is_supported = 2;
        optional Resource resource = 3;
    }

    repeated DeviceWithResource deviceWithResource = 1;
    FetchStrategy fetch_strategy = 2;
}

message FetchStrategy {
    oneof fetch_strategy {
        PollStrategy poll_strategy = 1;
        SubStrategy sub_strategy = 2;
    }
}

message PollStrategy {
    int32 interval_ms = 1;
}

message SubStrategy {
}

