///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
// All rights reserved.
//
// This software and its documentation and related materials are owned by
// the Alliance. The software may only be incorporated into application
// programs owned by members of the Alliance, subject to a signed
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable
// trade secrets of the Alliance and its suppliers. The software is also
// protected by copyright law and international treaty provisions. Application
// programs incorporating this software must include the following statement
// with their copyright notices:
//
//   This application incorporates Open Design Alliance software pursuant to a
//   license agreement with Open Design Alliance.
//   Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
//   All rights reserved.
//
// By use of this software, its documentation or related materials, you
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////

/**
 * Defines the data status.
 */
export interface IFileDataStatus {
  /**
   * Data state. Can be `none`, `waiting`, `inprogress`, `done` or `failed`.
   */
  state: string;

  /**
   * Unique ID of the data job.
   */
  jobId?: string;

  jobUrl?: string;
}

/**
 * Defines the file status.
 */
export interface IFileStatus {
  /**
   * Status of geometry data of `vsfx` type.
   */
  geometry: IFileDataStatus;

  /**
   * Status of geometry data of `gltf` type.
   */
  geometryGltf: IFileDataStatus;

  /**
   * Status of the properties.
   */
  properties: IFileDataStatus;

  /**
   * Status of the validation.
   */
  validation: IFileDataStatus;
}

/**
 * Reference to file.
 */
export interface IFileReference {
  /**
   * The ID of the referenced file.
   */
  id: string;

  /**
   * The name of the referenced file.
   */
  name: string;
}

/**
 * References are images, fonts, or any other files to correct rendering of the file.
 */
export interface IFileReferences {
  /**
   * The references list ID, changed after each update of the file references.
   */
  id: string;

  /**
   * List of file references or `null` if there are no references.
   */
  references: IFileReference[] | null;
}

/**
 * Defines the information about file version.
 */
export interface IFileVersionInfo {
  /**
   * Version file ID.
   */
  fileId: string;

  /**
   * Version file data status.
   */
  status: IFileStatus;

  /**
   * Zero-based version number. The original file has version `0`.
   */
  version: number;

  /**
   * Version creation time (UTC).
   */
  createdAt: string;

  /**
   * Size of the version file in bytes.
   */
  size: number;

  /**
   * ID of the user who created the version.
   */
  ownerId: string;
}

/**
 * Defines the user, project, or group that will have access to the file.
 */
export interface IGrantedTo {
  /**
   * The user that has access to the file.
   */
  user?: {
    /**
     * User ID.
     */
    id: string;

    /**
     * User email.
     */
    email: string;
  };

  /**
   * The project that has access to the file.
   */
  project?: {
    /**
     * Project ID.
     */
    id: string;

    /**
     * Project name.
     */
    name: string;
  };

  /**
   * The group that has access to the file.
   */
  group?: {
    /**
     * Project ID.
     */
    projectId: string;

    /**
     * Group ID.
     */
    groupId: string;

    /**
     * Group name.
     */
    name: string;
  };
}

/**
 * Defines the CDA tree node.
 */
export interface ICdaNode {
  /**
   * Object original handle.
   */
  handle: string;

  /**
   * Object name.
   */
  name: string;

  /**
   * Nested objects.
   */
  children: ICdaNode[];
}
