<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/essentialcontacts/v1/service.proto

namespace Google\Cloud\EssentialContacts\V1;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * A contact that will receive notifications from Google Cloud.
 *
 * Generated from protobuf message <code>google.cloud.essentialcontacts.v1.Contact</code>
 */
class Contact extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. The identifier for the contact.
     * Format: {resource_type}/{resource_id}/contacts/{contact_id}
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $name = '';
    /**
     * Required. The email address to send notifications to. The email address
     * does not need to be a Google Account.
     *
     * Generated from protobuf field <code>string email = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $email = '';
    /**
     * Required. The categories of notifications that the contact will receive
     * communications for.
     *
     * Generated from protobuf field <code>repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $notification_category_subscriptions;
    /**
     * Required. The preferred language for notifications, as a ISO 639-1 language
     * code. See [Supported
     * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
     * for a list of supported languages.
     *
     * Generated from protobuf field <code>string language_tag = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $language_tag = '';
    /**
     * The validity of the contact. A contact is considered valid if it is the
     * correct recipient for notifications for a particular resource.
     *
     * Generated from protobuf field <code>.google.cloud.essentialcontacts.v1.ValidationState validation_state = 8;</code>
     */
    protected $validation_state = 0;
    /**
     * The last time the validation_state was updated, either manually or
     * automatically. A contact is considered stale if its validation state was
     * updated more than 1 year ago.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp validate_time = 9;</code>
     */
    protected $validate_time = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Output only. The identifier for the contact.
     *           Format: {resource_type}/{resource_id}/contacts/{contact_id}
     *     @type string $email
     *           Required. The email address to send notifications to. The email address
     *           does not need to be a Google Account.
     *     @type array<int>|\Google\Protobuf\Internal\RepeatedField $notification_category_subscriptions
     *           Required. The categories of notifications that the contact will receive
     *           communications for.
     *     @type string $language_tag
     *           Required. The preferred language for notifications, as a ISO 639-1 language
     *           code. See [Supported
     *           languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
     *           for a list of supported languages.
     *     @type int $validation_state
     *           The validity of the contact. A contact is considered valid if it is the
     *           correct recipient for notifications for a particular resource.
     *     @type \Google\Protobuf\Timestamp $validate_time
     *           The last time the validation_state was updated, either manually or
     *           automatically. A contact is considered stale if its validation state was
     *           updated more than 1 year ago.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Essentialcontacts\V1\Service::initOnce();
        parent::__construct($data);
    }

    /**
     * Output only. The identifier for the contact.
     * Format: {resource_type}/{resource_id}/contacts/{contact_id}
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Output only. The identifier for the contact.
     * Format: {resource_type}/{resource_id}/contacts/{contact_id}
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Required. The email address to send notifications to. The email address
     * does not need to be a Google Account.
     *
     * Generated from protobuf field <code>string email = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Required. The email address to send notifications to. The email address
     * does not need to be a Google Account.
     *
     * Generated from protobuf field <code>string email = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setEmail($var)
    {
        GPBUtil::checkString($var, True);
        $this->email = $var;

        return $this;
    }

    /**
     * Required. The categories of notifications that the contact will receive
     * communications for.
     *
     * Generated from protobuf field <code>repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getNotificationCategorySubscriptions()
    {
        return $this->notification_category_subscriptions;
    }

    /**
     * Required. The categories of notifications that the contact will receive
     * communications for.
     *
     * Generated from protobuf field <code>repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param array<int>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setNotificationCategorySubscriptions($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\EssentialContacts\V1\NotificationCategory::class);
        $this->notification_category_subscriptions = $arr;

        return $this;
    }

    /**
     * Required. The preferred language for notifications, as a ISO 639-1 language
     * code. See [Supported
     * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
     * for a list of supported languages.
     *
     * Generated from protobuf field <code>string language_tag = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getLanguageTag()
    {
        return $this->language_tag;
    }

    /**
     * Required. The preferred language for notifications, as a ISO 639-1 language
     * code. See [Supported
     * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
     * for a list of supported languages.
     *
     * Generated from protobuf field <code>string language_tag = 4 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setLanguageTag($var)
    {
        GPBUtil::checkString($var, True);
        $this->language_tag = $var;

        return $this;
    }

    /**
     * The validity of the contact. A contact is considered valid if it is the
     * correct recipient for notifications for a particular resource.
     *
     * Generated from protobuf field <code>.google.cloud.essentialcontacts.v1.ValidationState validation_state = 8;</code>
     * @return int
     */
    public function getValidationState()
    {
        return $this->validation_state;
    }

    /**
     * The validity of the contact. A contact is considered valid if it is the
     * correct recipient for notifications for a particular resource.
     *
     * Generated from protobuf field <code>.google.cloud.essentialcontacts.v1.ValidationState validation_state = 8;</code>
     * @param int $var
     * @return $this
     */
    public function setValidationState($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\EssentialContacts\V1\ValidationState::class);
        $this->validation_state = $var;

        return $this;
    }

    /**
     * The last time the validation_state was updated, either manually or
     * automatically. A contact is considered stale if its validation state was
     * updated more than 1 year ago.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp validate_time = 9;</code>
     * @return \Google\Protobuf\Timestamp|null
     */
    public function getValidateTime()
    {
        return $this->validate_time;
    }

    public function hasValidateTime()
    {
        return isset($this->validate_time);
    }

    public function clearValidateTime()
    {
        unset($this->validate_time);
    }

    /**
     * The last time the validation_state was updated, either manually or
     * automatically. A contact is considered stale if its validation state was
     * updated more than 1 year ago.
     *
     * Generated from protobuf field <code>.google.protobuf.Timestamp validate_time = 9;</code>
     * @param \Google\Protobuf\Timestamp $var
     * @return $this
     */
    public function setValidateTime($var)
    {
        GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class);
        $this->validate_time = $var;

        return $this;
    }

}

