syntax = "proto3";

package com.wix.media.site_media.v1;

import "wix/api/annotations.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
import "com/wix/media/site_media/v1/operation_status.proto";
import "com/wix/media/site_media/v1/media_type.proto";
import "com/wix/media/site_media/v1/audio_v2.proto";
import "com/wix/media/site_media/v1/identity_info.proto";
import "com/wix/media/site_media/v1/image_media.proto";
import "com/wix/media/site_media/v1/other_media.proto";
import "com/wix/media/site_media/v1/font_media.proto";
import "com/wix/media/site_media/v1/namespace.proto";
import "wix/api/validations.proto";
import "wix/api/entity.proto";

import "com/wix/media/site_media/upstream/wix/common/media.proto";

message FileMedia {
  option (.wix.api.decomposition_minimum_fields) = {
    field: "image"
  };
  option (.wix.api.decomposition_minimum_fields) = {
    field: "video"
  };
  option (.wix.api.decomposition_minimum_fields) = {
    field: "document"
  };
  option (.wix.api.decomposition_minimum_fields) = {
    field: "audio"
  };

  option (.wix.api.decomposition_minimum_fields) = {
    field: "vector"
  };
  option (.wix.api.decomposition_minimum_fields) = {
    field: "archive"
  };
  option (.wix.api.decomposition_minimum_fields) = {
    field: "model3d"
  };
  option (.wix.api.decomposition_minimum_fields) = {
    field: "other"
  };
  oneof media {
    // Information about the image.
    ImageMedia image = 1;
    // Information about the video.
    com.wix.media.site_media.upstream.wix.common.VideoV2 video = 2;
    // Information about the audio.
    AudioV2 audio = 3;
    // Information about the document.
    com.wix.media.site_media.upstream.wix.common.Document document = 4;
    // Information about the vector.
    ImageMedia vector = 5;
    // Information about the archive.
    com.wix.media.site_media.upstream.wix.common.Archive archive = 6;
    // Information about the 3D Model.
    com.wix.media.site_media.upstream.wix.common.Model3D model3d = 7;
    // Information about other file types
    OtherMedia other  = 8 [(.wix.api.field_exposure) = INTERNAL];
    // Information about the icon.
    ImageMedia icon = 9 [(.wix.api.field_exposure) = INTERNAL];
    // Information about flash
    OtherMedia flash  = 10 [(.wix.api.field_exposure) = INTERNAL];
    // Information about the font
    FontMedia font = 11 [(.wix.api.field_exposure) = INTERNAL];
    // Information about a raw file
    OtherMedia raw = 12 [(.wix.api.field_exposure) = INTERNAL];
  }
}

message FileDescriptor {

  enum State {
    // File is ready for consumption
    OK = 0;
    // Deleted file
    DELETED = 1;
  };

  //flynt-disable missing-extensible
  option (.wix.api.entity) = {
    fqdn: "wix.media.site_media.v1.file_descriptor"
    segment: USERS
    trashbin: false
    app_def_id: "ad919edb-8ae2-403c-bef4-d5083b76d9e9"
    domain_events_read_permission: "MEDIA.SITE_MEDIA_FILES_READ"
    appendix_files: {
      type: DOCS_CONF,
      path: "appendices/docs"
    }
    appendix_files: {
      type: AUTO_VELO
      path: "appendices/velo/file"
    }
  };
  option (.wix.api.domain_event) = {
    event_type: ACTION
    action_message_fqn: "com.wix.media.site_media.v1.DraftFilePublished"
  };
  // File ID. Generated when a file is uploaded to the Media Manager.
  string id = 1 [(.wix.api.readOnly) = true, (.wix.api.maxLength) = 1000];
  // File name as it appears in the Media Manager.
  string display_name = 2 [(.wix.api.readOnly) = false, (.wix.api.maxLength) = 200];
  // Static URL of the file.
  string url = 3 [(.wix.api.readOnly) = true, (.wix.api.format) = WEB_URL];
  // ID of the file's parent folder.
  google.protobuf.StringValue parent_folder_id = 4 [(.wix.api.readOnly) = false, (.wix.api.maxLength) = 100];
  // File hash.
  string hash = 5 [(.wix.api.readOnly) = true, (.wix.api.maxLength) = 100];
  // Size of the uploaded file in bytes.
  google.protobuf.StringValue size_in_bytes = 6 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = PUBLIC, (.wix.api.format) = DECIMAL_VALUE, (.wix.api.decimalValue) = { maxScale: 0 }];
  // Whether the file is public or private. Learn more about private files ([SDK](https://dev.wix.com/docs/rest/assets/media/media-manager/files/private-files) | [REST](https://dev.wix.com/docs/sdk/backend-modules/media/files/private-files)).
  bool private = 7 [(.wix.api.readOnly) = true];
  // Media file type.
  MediaType media_type = 8 [(.wix.api.readOnly) = true];
  // Media file content.
  FileMedia media = 9 [(.wix.api.readOnly) = true];
  // Status of the file that was uploaded.
  // * `FAILED`: The file failed to upload, for example, during media post processing.
  // * `READY`: The file uploaded, finished all processing, and is ready for use.
  // * `PENDING`: The file is processing and the URLs are not yet available. This response is returned when importing a file.
  OperationStatus operation_status = 10 [(.wix.api.readOnly) = true];
  // URL where the file was uploaded from.
  google.protobuf.StringValue source_url = 11 [(.wix.api.readOnly) = true, (.wix.api.format) = WEB_URL];
  // URL of the file's thumbnail.
  google.protobuf.StringValue thumbnail_url = 12 [(.wix.api.readOnly) = true, (.wix.api.format) = WEB_URL];
  // Labels assigned to media files that describe and categorize them. Provided by the Wix user, or generated by [Google Vision API](https://cloud.google.com/vision/docs/drag-and-drop) for images. 
  repeated string labels = 13 [(.wix.api.maxSize) = 100, (.wix.api.readOnly) = false, (.wix.api.maxLength) = 200];
  // Date and time the file was created.
  google.protobuf.Timestamp created_date = 16 [(.wix.api.readOnly) = true];
  // Date and time the file was updated.
  google.protobuf.Timestamp updated_date = 17 [(.wix.api.readOnly) = true];
  // The Wix site ID where the media file is stored.
  string site_id = 18 [(.wix.api.readOnly) = true, (.wix.api.maxLength) = 100];
  // State of the file.
  State state = 19 [(.wix.api.readOnly) = true];
  // Internal tags describing the item, can be used in specific client use cases
  repeated string internal_tags = 20 [(.wix.api.field_exposure) = INTERNAL, (.wix.api.maxSize) = 100, (.wix.api.maxLength) = 200];
  // The namespace containing the file
  Namespace namespace = 21 [(.wix.api.field_exposure) = INTERNAL];
  // Information about the identity that added this file
  IdentityInfo added_by = 22 [(.wix.api.field_exposure) = INTERNAL];
  // The raw namespace containing the file
  google.protobuf.StringValue raw_namespace = 23 [(.wix.api.field_exposure) = INTERNAL, (.wix.api.readOnly) = true,  (.wix.api.maxLength) = 200];
  // The date this file was last viewed from the last day, can be used to know if this file is still in use
  google.protobuf.Timestamp last_used_date = 24 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = INTERNAL];
  // The date this file was last viewed from the last day, can be used to know if this file is still in use
  google.protobuf.StringValue mime_type = 25 [(.wix.api.readOnly) = true, (.wix.api.field_exposure) = INTERNAL, (.wix.api.maxLength) = 200];
}


