/**
 * # File Get Contents
 * Messages for a query to retrieve the content of a file in the
 * Hedera File Service (HFS).
 *
 * ### Keywords
 * The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
 * "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
 * document are to be interpreted as described in
 * [RFC2119](https://www.ietf.org/rfc/rfc2119) and clarified in
 * [RFC8174](https://www.ietf.org/rfc/rfc8174).
 */
syntax = "proto3";

package proto;

// SPDX-License-Identifier: Apache-2.0
option java_package = "com.hederahashgraph.api.proto.java";
// <<<pbj.java_package = "com.hedera.hapi.node.file">>> This comment is special code for setting PBJ Compiler java package
option java_multiple_files = true;

import "services_basic_types.proto";
import "services_query_header.proto";
import "services_response_header.proto";

/**
 * A query request to the Hedera File Service (HFS) for file content.<br/>
 * This query requests the content of a file, but none of the information
 * _about_ a file. A client should submit a `fileGetInfo` query to view
 * information about a file.<br/>
 * File content may also be available from a block node or mirror node,
 * generally at lower cost.
 */
message FileGetContentsQuery {
    /**
     * Standard information sent with every query operation.<br/>
     * This includes the signed payment and what kind of response is requested
     * (cost, state proof, both, or neither).
     */
    QueryHeader header = 1;

    /**
     * A file identifier.
     * <p>
     * This MUST be the identifier of a file that exists in HFS.<br/>
     * This value SHALL identify the file to be queried.
     */
    FileID fileID = 2;
}

/**
 * A response to a query for the content of a file in the
 * Hedera File Service (HFS).
 *
 * This message SHALL contain the full content of the requested file, but
 * SHALL NOT contain any metadata.
 */
message FileGetContentsResponse {
    /**
     * The standard response information for queries.<br/>
     * This includes the values requested in the `QueryHeader`
     * (cost, state proof, both, or neither).
     */
    ResponseHeader header = 1;

    message FileContents {
        /**
         * A file identifier.
         * <p>
         * This SHALL be the identifier of a file that exists in HFS.<br/>
         * This value SHALL identify the file that was queried.
         */
        FileID fileID = 1;

        /**
         * A byte array of file content.
         * <p>
         * This SHALL contain the full content of the requested file.<br/>
         * This SHALL be empty if, and only if, the file content is empty.
         */
        bytes contents = 2;
    }

    /**
     * A combination of File identifier and content bytes.
     * <p>
     * This SHALL NOT be set if the file does not exist.<br/>
     * The network MAY generate a state proof for this field.
     */
    FileContents fileContents = 2;
}
