<?php
namespace google\protobuf;

// @@protoc_insertion_point(namespace:.google.protobuf.FieldDescriptorProto)

/**
 * Generated by the protocol buffer compiler.  DO NOT EDIT!
 * source: google/protobuf/descriptor.proto
 *
 * Describes a field within a message.
 *
 * -*- magic methods -*-
 *
 * @method string getName()
 * @method void setName(string $value)
 * @method string getNumber()
 * @method void setNumber(string $value)
 * @method \google\protobuf\FieldDescriptorProto\Label getLabel()
 * @method void setLabel(\google\protobuf\FieldDescriptorProto\Label $value)
 * @method \google\protobuf\FieldDescriptorProto\Type getType()
 * @method void setType(\google\protobuf\FieldDescriptorProto\Type $value)
 * @method string getTypeName()
 * @method void setTypeName(string $value)
 * @method string getExtendee()
 * @method void setExtendee(string $value)
 * @method string getDefaultValue()
 * @method void setDefaultValue(string $value)
 * @method \google\protobuf\FieldOptions getOptions()
 * @method void setOptions(\google\protobuf\FieldOptions $value)
 */
class FieldDescriptorProto extends \ProtocolBuffers\Message
{
  // @@protoc_insertion_point(traits:.google.protobuf.FieldDescriptorProto)
  
  /**
   * @var string $name
   * @tag 1
   * @label optional
   * @type \ProtocolBuffers::TYPE_STRING
   **/
  protected $name;
  
  /**
   * @var string $number
   * @tag 3
   * @label optional
   * @type \ProtocolBuffers::TYPE_INT32
   **/
  protected $number;
  
  /**
   * @var \google\protobuf\FieldDescriptorProto\Label $label
   * @tag 4
   * @label optional
   * @type \ProtocolBuffers::TYPE_ENUM
   * @see \google\protobuf\FieldDescriptorProto\Label
   **/
  protected $label;
  
  /**
   * If type_name is set, this need not be set.  If both this and type_name
   * are set, this must be either TYPE_ENUM or TYPE_MESSAGE.
   *
   * @var \google\protobuf\FieldDescriptorProto\Type $type
   * @tag 5
   * @label optional
   * @type \ProtocolBuffers::TYPE_ENUM
   * @see \google\protobuf\FieldDescriptorProto\Type
   **/
  protected $type;
  
  /**
   * For message and enum types, this is the name of the type.  If the name
   * starts with a '.', it is fully-qualified.  Otherwise, C++-like scoping
   * rules are used to find the type (i.e. first the nested types within this
   * message are searched, then within the parent, on up to the root
   * namespace).
   *
   * @var string $type_name
   * @tag 6
   * @label optional
   * @type \ProtocolBuffers::TYPE_STRING
   **/
  protected $type_name;
  
  /**
   * For extensions, this is the name of the type being extended.  It is
   * resolved in the same manner as type_name.
   *
   * @var string $extendee
   * @tag 2
   * @label optional
   * @type \ProtocolBuffers::TYPE_STRING
   **/
  protected $extendee;
  
  /**
   * For numeric types, contains the original text representation of the value.
   * For booleans, "true" or "false".
   * For strings, contains the default text contents (not escaped in any way).
   * For bytes, contains the C escaped value.  All bytes >= 128 are escaped.
   * TODO(kenton):  Base-64 encode?
   *
   * @var string $default_value
   * @tag 7
   * @label optional
   * @type \ProtocolBuffers::TYPE_STRING
   **/
  protected $default_value;
  
  /**
   * @var \google\protobuf\FieldOptions $options
   * @tag 8
   * @label optional
   * @type \ProtocolBuffers::TYPE_MESSAGE
   **/
  protected $options;
  
  
  // @@protoc_insertion_point(properties_scope:.google.protobuf.FieldDescriptorProto)

  /**
   *  helper method for retriviing parent FileDescriptorProto message
   *
   *  @return \google\protobuf\FileDescriptorProto
   */
  public function file()
  {
    $parent = $this->containerOf();
    while ($parent && !($parent instanceof \google\protobuf\FileDescriptorProto)) {
      $parent = $parent->containerOf();
    }
    return $parent;
  }
  // @@protoc_insertion_point(class_scope:.google.protobuf.FieldDescriptorProto)

  /**
   * get descriptor for protocol buffers
   * 
   * @return \ProtocolBuffersDescriptor
   */
  public static function getDescriptor()
  {
    static $descriptor;
    
    if (!isset($descriptor)) {
      $desc = new \ProtocolBuffers\DescriptorBuilder();
      $desc->addField(1, new \ProtocolBuffers\FieldDescriptor(array(
        "type"     => \ProtocolBuffers::TYPE_STRING,
        "name"     => "name",
        "required" => false,
        "optional" => true,
        "repeated" => false,
        "packable" => false,
        "default"  => "",
      )));
      $desc->addField(3, new \ProtocolBuffers\FieldDescriptor(array(
        "type"     => \ProtocolBuffers::TYPE_INT32,
        "name"     => "number",
        "required" => false,
        "optional" => true,
        "repeated" => false,
        "packable" => false,
        "default"  => null,
      )));
      $desc->addField(4, new \ProtocolBuffers\FieldDescriptor(array(
        "type"     => \ProtocolBuffers::TYPE_ENUM,
        "name"     => "label",
        "required" => false,
        "optional" => true,
        "repeated" => false,
        "packable" => false,
        "default"  => null,
      )));
      $desc->addField(5, new \ProtocolBuffers\FieldDescriptor(array(
        "type"     => \ProtocolBuffers::TYPE_ENUM,
        "name"     => "type",
        "required" => false,
        "optional" => true,
        "repeated" => false,
        "packable" => false,
        "default"  => null,
      )));
      $desc->addField(6, new \ProtocolBuffers\FieldDescriptor(array(
        "type"     => \ProtocolBuffers::TYPE_STRING,
        "name"     => "type_name",
        "required" => false,
        "optional" => true,
        "repeated" => false,
        "packable" => false,
        "default"  => "",
      )));
      $desc->addField(2, new \ProtocolBuffers\FieldDescriptor(array(
        "type"     => \ProtocolBuffers::TYPE_STRING,
        "name"     => "extendee",
        "required" => false,
        "optional" => true,
        "repeated" => false,
        "packable" => false,
        "default"  => "",
      )));
      $desc->addField(7, new \ProtocolBuffers\FieldDescriptor(array(
        "type"     => \ProtocolBuffers::TYPE_STRING,
        "name"     => "default_value",
        "required" => false,
        "optional" => true,
        "repeated" => false,
        "packable" => false,
        "default"  => "",
      )));
      $desc->addField(8, new \ProtocolBuffers\FieldDescriptor(array(
        "type"     => \ProtocolBuffers::TYPE_MESSAGE,
        "name"     => "options",
        "required" => false,
        "optional" => true,
        "repeated" => false,
        "packable" => false,
        "default"  => null,
        "message" => '\google\protobuf\FieldOptions',
      )));
      // @@protoc_insertion_point(builder_scope:.google.protobuf.FieldDescriptorProto)

      $descriptor = $desc->build();
    }
    return $descriptor;
  }

}
