syntax = "proto3";

package com.wix.media.site_media.upstream.wix.common;

option java_multiple_files = true;
option java_package = "com.wix.media.site_media.upstream.wix.common";

import "wix/api/annotations.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "wix/api/validations.proto";

// flynt-disable deleted-field-enum-reserved
message Image {
    option (.wix.api.decomposite_of) = "wix.common.Image";
    option (.wix.api.decomposition_minimum_fields) = {
        field: "id"
        field: "height"
        field: "width"
    };
    // WixMedia image ID.
    // flynt-disable missing-string-validations
    string id = 1;
    // Image URL.
    // flynt-disable missing-string-validations
    string url = 2;
    // Original image height.
    int32 height = 3 [(.wix.api.readOnly) = true];
    // Original image width.
    int32 width = 4 [(.wix.api.readOnly) = true];
    // Image alt text.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue alt_text = 5;
    // Image URL expiration date (when relevant).
    google.protobuf.Timestamp url_expiration_date = 6 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE];
    // Image filename.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue filename = 7 [(.wix.api.readOnly) = true];
    // Image size in bytes.
    // flynt-disable decimal-value-without-validations
    google.protobuf.StringValue size_in_bytes = 8 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE, (.wix.api.format) = DECIMAL_VALUE];
    // Focal point of the image.
    FocalPoint focal_point = 9 [(.wix.api.field_exposure) = PRIVATE];
    // Details about the image content.
//    ImageContent image_content = 10 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = INTERNAL];
}

// Deprecated - use VideoV2
message Video {
    option (.wix.api.decomposite_of) = "wix.common.Video";
    option deprecated = true;
    option (.wix.api.decomposition_minimum_fields) = {
        field: "id"
        field: "url"
        field: "height"
        field: "width"
    };
    // WixMedia ID
    // flynt-disable missing-string-validations
    string id = 1;
    // URL of video
    // flynt-disable missing-string-validations
    string url = 2;
    // Original image height
    int32 height = 3 [(.wix.api.readOnly) = true];
    // Original image width
    int32 width = 4 [(.wix.api.readOnly) = true];
    // Video poster
    Image thumbnail = 5;
}

message VideoV2 {
    option (.wix.api.decomposite_of) = "wix.common.VideoV2";
    option (.wix.api.decomposition_minimum_fields) = {
        field: "id"
        field: "resolutions"
    };
    // WixMedia ID.
    // flynt-disable missing-string-validations
    string id = 1;
    // Original video URL.
    // flynt-disable missing-string-validations
    string url = 4 [(.wix.api.field_exposure) = PRIVATE];
    // Available resolutions for the video, starting with the optimal resolution.
    repeated VideoResolution resolutions = 2 [(.wix.api.readOnly) = true, (.wix.api.maxSize) = 100];
    // Video filename.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue filename = 3 [(.wix.api.readOnly) = true];
    // Video posters.
    repeated Image posters = 5 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE, (.wix.api.maxSize) = 10];
    // Original video size in bytes.
    // flynt-disable decimal-value-without-validations
    google.protobuf.StringValue size_in_bytes = 6 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE, (.wix.api.format) = DECIMAL_VALUE];
    // Video URL expiration date (when relevant).
    google.protobuf.Timestamp url_expiration_date = 7 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE];
    // Original video duration in milliseconds.
    google.protobuf.Int32Value duration_in_milliseconds = 8 [(.wix.api.field_exposure) = PRIVATE, (.wix.api.readOnly) = true, (.wix.api.min) = 0];
    // A short title for the video. will be used for SEO purposes.
    google.protobuf.StringValue title = 9 [(.wix.api.maxLength) = 300, (.wix.api.field_exposure) = PRIVATE];
    // A long description for the video. will be used for SEO purposes.
    google.protobuf.StringValue description = 10 [(.wix.api.maxLength) = 2000, (.wix.api.field_exposure) = PRIVATE];
    // Original video height.
    google.protobuf.Int32Value height = 11 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE, (.wix.api.min) = 0];
    // Original video width.
    google.protobuf.Int32Value width = 12 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE, (.wix.api.min) = 0];
}

message VideoResolution {
    option (.wix.api.decomposite_of) = "wix.common.VideoResolution";
    option (.wix.api.decomposition_minimum_fields) = {
        field: "url"
        field: "height"
        field: "width"
        field: "poster"
        field: "format"
    };
    // Video URL.
    // flynt-disable missing-string-validations
    string url = 2;
    // Video height.
    int32 height = 3;
    // Video width.
    int32 width = 4;
    // Deprecated. Use the `posters` property in the parent entity instead.
    // flynt-disable missing-deprecated-field-annotation
    Image poster = 5 [(.wix.api.field_exposure) = PRIVATE, deprecated = true];
    // Video format
    // Possible values: ['144p.mp4' '144p.webm' '240p.mp4' '240p.webm' '360p.mp4' '360p.webm' '480p.mp4' '480p.webm'
    // '720p.mp4' '720p.webm' '1080p.mp4' '1080p.webm', 'hls' ]
    // flynt-disable missing-string-validations
    string format = 6;
    // Deprecated. Use the `urlExpirationDate` property in the parent entity instead.
    // flynt-disable missing-deprecated-field-annotation
    google.protobuf.Timestamp url_expiration_date = 7 [(.wix.api.field_exposure) = PRIVATE, deprecated = true];
    // Deprecated. Use the `sizeInBytes` property in the parent entity instead. Size cannot be provided per resolution.
    // flynt-disable decimal-value-without-validations, missing-deprecated-field-annotation
    google.protobuf.StringValue size_in_bytes = 8 [(.wix.api.field_exposure) = PRIVATE, (.wix.api.format) = DECIMAL_VALUE, deprecated = true];
    // Video quality. For example: 480p, 720p.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue quality = 9 [(.wix.api.field_exposure) = PRIVATE];
    // Video filename.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue filename = 10 [(.wix.api.field_exposure) = PRIVATE];
    // Video duration in seconds.
    // flynt-disable missing-deprecated-field-annotation
    google.protobuf.Int32Value duration_in_seconds = 11 [(.wix.api.field_exposure) = PRIVATE, (.wix.api.readOnly) = true, (.wix.api.min) = 0, (.wix.api.field_deprecated) = {
        replaced_by: "duration_in_milliseconds"
        target_removal_date: "2024-08-01"
    }];
    // Video duration in milliseconds.
    google.protobuf.Int32Value duration_in_milliseconds = 12 [(.wix.api.field_exposure) = PRIVATE, (.wix.api.readOnly) = true, (.wix.api.min) = 0];

    // When true, this is a protected asset, and calling the URL will return a 403 error.
    // In order to access private assets, make a request to:
    // `GenerateFileDownloadUrl` with the WixMedia id and specify the asset_key in the request
    google.protobuf.BoolValue private = 30 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE];
    // Key to identify the video resolution's relationship to the original media in WixMedia.
    // Can be used to request a download for the specific video resolution.
    // For example: 480p.mp4, 720p.mp4, 1080p.mp4, trailer-720p.mp4, clip-720p.mp4
    // flynt-disable missing-string-validations
    google.protobuf.StringValue asset_key = 31 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE];
}

message Audio {
    option (.wix.api.decomposite_of) = "wix.common.Audio";
    option (.wix.api.decomposition_minimum_fields) = {
        field: "id"
        field: "url"
    };
    // WixMedia ID.
    // flynt-disable missing-string-validations
    string id = 1;
    // Audio URL.
    // flynt-disable missing-string-validations
    string url = 2;
    // Audio URL expiration date (when relevant).
    google.protobuf.Timestamp url_expiration_date = 3 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE];
    // Audio size in bytes.
    // flynt-disable decimal-value-without-validations
    google.protobuf.StringValue size_in_bytes = 4 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE, (.wix.api.format) = DECIMAL_VALUE];
    // Audio filename.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue filename = 5 [(.wix.api.readOnly) = true];
    // Audio duration in milliseconds.
    google.protobuf.Int32Value duration = 6 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE, (.wix.api.min) = 0];

    // When true, this is a protected asset, and calling the URL will return a 403 error.
    // In order to access private assets, make a request to:
    // `GenerateFileDownloadUrl` with the WixMedia id and specify the asset_key in the request
    google.protobuf.BoolValue private = 30 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE];
    // Key to identify the object relationship to the original media in WixMedia.
    // Can be used to request a download for the specific asset.
    // For example: 128-30kbs.mp3, 320kbs.mp3, 128kbs.mp3
    // flynt-disable missing-string-validations
    google.protobuf.StringValue asset_key = 31 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE];
    // Audio format.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue format = 32 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE];
    // Audio quality.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue quality = 33 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE];
}

message Document {
    option (.wix.api.decomposite_of) = "wix.common.Document";
    option (.wix.api.decomposition_minimum_fields) = {
        field: "id"
        field: "url"
    };
    // WixMedia ID.
    // flynt-disable missing-string-validations
    string id = 1;
    // Document URL.
    // flynt-disable missing-string-validations
    string url = 2;
    // Document URL expiration date (when relevant).
    google.protobuf.Timestamp url_expiration_date = 3 [(.wix.api.field_exposure) = PRIVATE];
    // Document size in bytes.
    // flynt-disable decimal-value-without-validations
    google.protobuf.StringValue size_in_bytes = 4 [(.wix.api.field_exposure) = PRIVATE, (.wix.api.format) = DECIMAL_VALUE];
    // Document filename.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue filename = 5;
    // Document thumbnail.
    Image thumbnail = 6 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PRIVATE];
}

message Model3D {
    option (.wix.api.decomposite_of) = "wix.common.Model3D";
    option (.wix.api.decomposition_minimum_fields) = {
        field: "id"
    };
    // WixMedia 3D ID.
    // flynt-disable missing-string-validations
    string id = 1;
    // 3D URL.
    // flynt-disable missing-string-validations
    string url = 2;
    // 3D thumbnail Image
    Image thumbnail = 3;
    // 3D alt text.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue alt_text = 5;
    // 3D URL expiration date (when relevant).
    google.protobuf.Timestamp url_expiration_date = 6 [(.wix.api.readOnly) = true];
    // 3D filename.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue filename = 7 [(.wix.api.readOnly) = true];
    // 3D size in bytes.
    // flynt-disable decimal-value-without-validations
    google.protobuf.StringValue size_in_bytes = 8 [(.wix.api.readOnly) = true, (.wix.api.format) = DECIMAL_VALUE];
}


message Archive {
    option (.wix.api.decomposite_of) = "wix.common.Archive";
    option (.wix.api.decomposition_minimum_fields) = {
        field: "id"
    };
    // WixMedia ID.
    // flynt-disable missing-string-validations
    string id = 1;
    // Archive URL.
    // flynt-disable missing-string-validations
    string url = 2;
    // Archive URL expiration date (when relevant).
    google.protobuf.Timestamp url_expiration_date = 3 [(.wix.api.readOnly) = true];
    // Archive size in bytes.
    // flynt-disable decimal-value-without-validations
    google.protobuf.StringValue size_in_bytes = 4 [(.wix.api.format) = DECIMAL_VALUE];
    // Archive filename.
    // flynt-disable missing-string-validations
    google.protobuf.StringValue filename = 5;
}




// Deprecated - Copy this message into your service, do not reference it
message MediaItem {
    option (.wix.api.decomposite_of) = "wix.common.MediaItem";
    option deprecated = true;
    option (.wix.api.decomposition_minimum_fields) = {
        field: "image"
    };
    option (.wix.api.decomposition_minimum_fields) = {
        field: "video"
    };
    option (.wix.api.decomposition_minimum_fields) = {
        field: "document"
    };
    oneof media {
        Image image = 1; // WixMedia image
        Video video = 2; // WixMedia video
        Document document = 3; // WixMedia document
    }
}

message FocalPoint {
    option (.wix.api.decomposite_of) = "wix.common.FocalPoint";
    // X-coordinate of the focal point.
    double x = 1;
    // Y-coordinate of the focal point.
    double y = 2;
    // crop by height
    google.protobuf.Int32Value height = 3;
    // crop by width
    google.protobuf.Int32Value width = 4;
}