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

namespace Google\Cloud\OsConfig\V1;

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

/**
 * Represents a monthly schedule. An example of a valid monthly schedule is
 * "on the third Tuesday of the month" or "on the 15th of the month".
 *
 * Generated from protobuf message <code>google.cloud.osconfig.v1.MonthlySchedule</code>
 */
class MonthlySchedule extends \Google\Protobuf\Internal\Message
{
    protected $day_of_month;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\OsConfig\V1\WeekDayOfMonth $week_day_of_month
     *           Required. Week day in a month.
     *     @type int $month_day
     *           Required. One day of the month. 1-31 indicates the 1st to the 31st day.
     *           -1 indicates the last day of the month. Months without the target day
     *           will be skipped. For example, a schedule to run "every month on the 31st"
     *           will not run in February, April, June, etc.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Osconfig\V1\PatchDeployments::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Week day in a month.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.WeekDayOfMonth week_day_of_month = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\OsConfig\V1\WeekDayOfMonth|null
     */
    public function getWeekDayOfMonth()
    {
        return $this->readOneof(1);
    }

    public function hasWeekDayOfMonth()
    {
        return $this->hasOneof(1);
    }

    /**
     * Required. Week day in a month.
     *
     * Generated from protobuf field <code>.google.cloud.osconfig.v1.WeekDayOfMonth week_day_of_month = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\OsConfig\V1\WeekDayOfMonth $var
     * @return $this
     */
    public function setWeekDayOfMonth($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\OsConfig\V1\WeekDayOfMonth::class);
        $this->writeOneof(1, $var);

        return $this;
    }

    /**
     * Required. One day of the month. 1-31 indicates the 1st to the 31st day.
     * -1 indicates the last day of the month. Months without the target day
     * will be skipped. For example, a schedule to run "every month on the 31st"
     * will not run in February, April, June, etc.
     *
     * Generated from protobuf field <code>int32 month_day = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return int
     */
    public function getMonthDay()
    {
        return $this->readOneof(2);
    }

    public function hasMonthDay()
    {
        return $this->hasOneof(2);
    }

    /**
     * Required. One day of the month. 1-31 indicates the 1st to the 31st day.
     * -1 indicates the last day of the month. Months without the target day
     * will be skipped. For example, a schedule to run "every month on the 31st"
     * will not run in February, April, June, etc.
     *
     * Generated from protobuf field <code>int32 month_day = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param int $var
     * @return $this
     */
    public function setMonthDay($var)
    {
        GPBUtil::checkInt32($var);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getDayOfMonth()
    {
        return $this->whichOneof("day_of_month");
    }

}

