// Extracted from: Spotify 1.2.52.442 (windows)

syntax = "proto3";

package spotify.offline.proto;

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

option optimize_for = CODE_SIZE;

message Capacity {
    double total_space = 1;
    double free_space = 2;
    double offline_space = 3;
    uint64 track_count = 4;
    uint64 episode_count = 5;
}

message Capabilities {
    bool remote_downloads_enabled = 1;
}

message Device {
    string device_id = 1;
    string cache_id = 2;
    string name = 3;
    int32 type = 4;
    int32 platform = 5;
    bool offline_enabled = 6;
    Capacity capacity = 7;
    Capabilities capabilities = 8;
    google.protobuf.Timestamp updated_at = 9;
    google.protobuf.Timestamp last_seen_at = 10;
    bool removal_pending = 11;
    string client_id = 12;
}

message Restrictions {
    google.protobuf.Duration allowed_duration_tracks = 1;
    uint64 max_tracks = 2;
    google.protobuf.Duration allowed_duration_episodes = 3;
    uint64 max_episodes = 4;
    google.protobuf.Duration allowed_duration_abp_chapters = 5;
}

message Resource {
    string uri = 1;
    ResourceState state = 2;
    int32 progress = 3;
    google.protobuf.Timestamp updated_at = 4;
    string failure_message = 5;
}

message DeviceKey {
    string user_id = 1;
    string device_id = 2;
    string cache_id = 3;
}

message ResourceForDevice {
    string device_id = 1;
    string cache_id = 2;
    Resource resource = 3;
}

message ResourceOperation {
    enum Operation {
        INVALID = 0;
        ADD = 1;
        REMOVE = 2;
    }

    Operation operation = 2;
    string uri = 3;
}

message ResourceHistoryItem {
    repeated ResourceOperation operations = 1;
    google.protobuf.Timestamp server_time = 2;
}

enum ResourceState {
    UNSPECIFIED = 0;
    REQUESTED = 1;
    PENDING = 2;
    DOWNLOADING = 3;
    DOWNLOADED = 4;
    FAILURE = 5;
}
