// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package designcompose.definition;

import "definition/element/variable.proto";
import "definition/view/view.proto";

option java_multiple_files = true;
option java_package = "com.android.designcompose.definition";
option optimize_for = LITE_RUNTIME;

// A separate header message that quickly identifies the main DesignComposeDefinition
message DesignComposeDefinitionHeader {
  uint32 dc_version = 1; // DesignCompose version
  string last_modified = 2; // Last modified timestamp
  string name = 3; // Design name
  string response_version = 4; // Figma response version
  string id = 5; // Design ID
}

// A serialized Figma design document, containing views, images, component sets,
// version, ID, and variable map. It's used for storing and loading Figma
// designs in a DesignCompose project.
message DesignComposeDefinition {
  
  // The string here is a NodeQuery, encoded to a string so that it can be used
  // as the key to the map.  See crates/dc_bundle/src/definition.rs for encoding/decoding
  map<string, definition.view.View> views = 1;
  // Images contains a mapping from ImageKey to network bytes. It can
  // create an ImageMap and is intended to be used when we want to use
  // Figma-defined components but do not want to communicate with the Figma
  // service.
  map<string, bytes> images = 2;
  map<string, string> component_sets = 3;
  definition.element.VariableMap variable_map = 4;
}

