package pb

import (
	url "net/url"
	strconv "strconv"

	urlenc "github.com/erda-project/erda-infra/pkg/urlenc"
	timestamppb "google.golang.org/protobuf/types/known/timestamppb"
	wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
)

var _ urlenc.URLValuesUnmarshaler = (*Cron)(nil)
var _ urlenc.URLValuesUnmarshaler = (*CronExtra)(nil)
var _ urlenc.URLValuesUnmarshaler = (*CronCompensator)(nil)

func (m *Cron) UnmarshalURLValues(prefix string, values url.Values) error {
	for key, vals := range values {
		if len(vals) > 0 {
			switch prefix + key {
			case "ID":
				val, err := strconv.ParseUint(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.ID = val
			case "timeCreated":
				if m.TimeCreated == nil {
					m.TimeCreated = &timestamppb.Timestamp{}
				}
			case "timeCreated.seconds":
				if m.TimeCreated == nil {
					m.TimeCreated = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.TimeCreated.Seconds = val
			case "timeCreated.nanos":
				if m.TimeCreated == nil {
					m.TimeCreated = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.TimeCreated.Nanos = int32(val)
			case "timeUpdated":
				if m.TimeUpdated == nil {
					m.TimeUpdated = &timestamppb.Timestamp{}
				}
			case "timeUpdated.seconds":
				if m.TimeUpdated == nil {
					m.TimeUpdated = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.TimeUpdated.Seconds = val
			case "timeUpdated.nanos":
				if m.TimeUpdated == nil {
					m.TimeUpdated = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.TimeUpdated.Nanos = int32(val)
			case "applicationID":
				val, err := strconv.ParseUint(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.ApplicationID = val
			case "branch":
				m.Branch = vals[0]
			case "cronExpr":
				m.CronExpr = vals[0]
			case "cronStartTime":
				if m.CronStartTime == nil {
					m.CronStartTime = &timestamppb.Timestamp{}
				}
			case "cronStartTime.seconds":
				if m.CronStartTime == nil {
					m.CronStartTime = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.CronStartTime.Seconds = val
			case "cronStartTime.nanos":
				if m.CronStartTime == nil {
					m.CronStartTime = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.CronStartTime.Nanos = int32(val)
			case "pipelineYmlName":
				m.PipelineYmlName = vals[0]
			case "basePipelineID":
				val, err := strconv.ParseUint(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.BasePipelineID = val
			case "enable":
				if m.Enable == nil {
					m.Enable = &wrapperspb.BoolValue{}
				}
			case "enable.value":
				if m.Enable == nil {
					m.Enable = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Enable.Value = val
			case "pipelineYml":
				m.PipelineYml = vals[0]
			case "configManageNamespaces":
				m.ConfigManageNamespaces = vals
			case "userID":
				m.UserID = vals[0]
			case "orgID":
				val, err := strconv.ParseUint(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.OrgID = val
			case "pipelineDefinitionID":
				m.PipelineDefinitionID = vals[0]
			case "pipelineSource":
				m.PipelineSource = vals[0]
			case "extra":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
			case "extra.pipelineYml":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				m.Extra.PipelineYml = vals[0]
			case "extra.clusterName":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				m.Extra.ClusterName = vals[0]
			case "extra.configManageNamespaces":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				m.Extra.ConfigManageNamespaces = vals
			case "extra.cronStartFrom":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.CronStartFrom == nil {
					m.Extra.CronStartFrom = &timestamppb.Timestamp{}
				}
			case "extra.cronStartFrom.seconds":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.CronStartFrom == nil {
					m.Extra.CronStartFrom = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.Extra.CronStartFrom.Seconds = val
			case "extra.cronStartFrom.nanos":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.CronStartFrom == nil {
					m.Extra.CronStartFrom = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.Extra.CronStartFrom.Nanos = int32(val)
			case "extra.version":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				m.Extra.Version = vals[0]
			case "extra.compensator":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
			case "extra.compensator.enable":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.Enable == nil {
					m.Extra.Compensator.Enable = &wrapperspb.BoolValue{}
				}
			case "extra.compensator.enable.value":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.Enable == nil {
					m.Extra.Compensator.Enable = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Extra.Compensator.Enable.Value = val
			case "extra.compensator.LatestFirst":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.LatestFirst == nil {
					m.Extra.Compensator.LatestFirst = &wrapperspb.BoolValue{}
				}
			case "extra.compensator.LatestFirst.value":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.LatestFirst == nil {
					m.Extra.Compensator.LatestFirst = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Extra.Compensator.LatestFirst.Value = val
			case "extra.compensator.StopIfLatterExecuted":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.StopIfLatterExecuted == nil {
					m.Extra.Compensator.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
			case "extra.compensator.StopIfLatterExecuted.value":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.StopIfLatterExecuted == nil {
					m.Extra.Compensator.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Extra.Compensator.StopIfLatterExecuted.Value = val
			case "extra.lastCompensateAt":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.LastCompensateAt == nil {
					m.Extra.LastCompensateAt = &timestamppb.Timestamp{}
				}
			case "extra.lastCompensateAt.seconds":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.LastCompensateAt == nil {
					m.Extra.LastCompensateAt = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.Extra.LastCompensateAt.Seconds = val
			case "extra.lastCompensateAt.nanos":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.LastCompensateAt == nil {
					m.Extra.LastCompensateAt = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.Extra.LastCompensateAt.Nanos = int32(val)
			case "IsEdge":
				if m.IsEdge == nil {
					m.IsEdge = &wrapperspb.BoolValue{}
				}
			case "IsEdge.value":
				if m.IsEdge == nil {
					m.IsEdge = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.IsEdge.Value = val
			}
		}
	}
	return nil
}

func (m *CronExtra) UnmarshalURLValues(prefix string, values url.Values) error {
	for key, vals := range values {
		if len(vals) > 0 {
			switch prefix + key {
			case "pipelineYml":
				m.PipelineYml = vals[0]
			case "clusterName":
				m.ClusterName = vals[0]
			case "configManageNamespaces":
				m.ConfigManageNamespaces = vals
			case "cronStartFrom":
				if m.CronStartFrom == nil {
					m.CronStartFrom = &timestamppb.Timestamp{}
				}
			case "cronStartFrom.seconds":
				if m.CronStartFrom == nil {
					m.CronStartFrom = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.CronStartFrom.Seconds = val
			case "cronStartFrom.nanos":
				if m.CronStartFrom == nil {
					m.CronStartFrom = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.CronStartFrom.Nanos = int32(val)
			case "version":
				m.Version = vals[0]
			case "compensator":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
			case "compensator.enable":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.Enable == nil {
					m.Compensator.Enable = &wrapperspb.BoolValue{}
				}
			case "compensator.enable.value":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.Enable == nil {
					m.Compensator.Enable = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Compensator.Enable.Value = val
			case "compensator.LatestFirst":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.LatestFirst == nil {
					m.Compensator.LatestFirst = &wrapperspb.BoolValue{}
				}
			case "compensator.LatestFirst.value":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.LatestFirst == nil {
					m.Compensator.LatestFirst = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Compensator.LatestFirst.Value = val
			case "compensator.StopIfLatterExecuted":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.StopIfLatterExecuted == nil {
					m.Compensator.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
			case "compensator.StopIfLatterExecuted.value":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.StopIfLatterExecuted == nil {
					m.Compensator.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Compensator.StopIfLatterExecuted.Value = val
			case "lastCompensateAt":
				if m.LastCompensateAt == nil {
					m.LastCompensateAt = &timestamppb.Timestamp{}
				}
			case "lastCompensateAt.seconds":
				if m.LastCompensateAt == nil {
					m.LastCompensateAt = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.LastCompensateAt.Seconds = val
			case "lastCompensateAt.nanos":
				if m.LastCompensateAt == nil {
					m.LastCompensateAt = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.LastCompensateAt.Nanos = int32(val)
			}
		}
	}
	return nil
}

func (m *CronCompensator) UnmarshalURLValues(prefix string, values url.Values) error {
	for key, vals := range values {
		if len(vals) > 0 {
			switch prefix + key {
			case "enable":
				if m.Enable == nil {
					m.Enable = &wrapperspb.BoolValue{}
				}
			case "enable.value":
				if m.Enable == nil {
					m.Enable = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Enable.Value = val
			case "LatestFirst":
				if m.LatestFirst == nil {
					m.LatestFirst = &wrapperspb.BoolValue{}
				}
			case "LatestFirst.value":
				if m.LatestFirst == nil {
					m.LatestFirst = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.LatestFirst.Value = val
			case "StopIfLatterExecuted":
				if m.StopIfLatterExecuted == nil {
					m.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
			case "StopIfLatterExecuted.value":
				if m.StopIfLatterExecuted == nil {
					m.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.StopIfLatterExecuted.Value = val
			}
		}
	}
	return nil
}
// Code generated by protoc-gen-go-form. DO NOT EDIT.
// Source: cron_pub.proto

package pb

import (
	url "net/url"
	strconv "strconv"

	urlenc "github.com/erda-project/erda-infra/pkg/urlenc"
	timestamppb "google.golang.org/protobuf/types/known/timestamppb"
	wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the "github.com/erda-project/erda-infra/pkg/urlenc" package it is being compiled against.
var _ urlenc.URLValuesUnmarshaler = (*Cron)(nil)
var _ urlenc.URLValuesUnmarshaler = (*CronExtra)(nil)
var _ urlenc.URLValuesUnmarshaler = (*CronCompensator)(nil)

// Cron implement urlenc.URLValuesUnmarshaler.
func (m *Cron) UnmarshalURLValues(prefix string, values url.Values) error {
	for key, vals := range values {
		if len(vals) > 0 {
			switch prefix + key {
			case "ID":
				val, err := strconv.ParseUint(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.ID = val
			case "timeCreated":
				if m.TimeCreated == nil {
					m.TimeCreated = &timestamppb.Timestamp{}
				}
			case "timeCreated.seconds":
				if m.TimeCreated == nil {
					m.TimeCreated = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.TimeCreated.Seconds = val
			case "timeCreated.nanos":
				if m.TimeCreated == nil {
					m.TimeCreated = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.TimeCreated.Nanos = int32(val)
			case "timeUpdated":
				if m.TimeUpdated == nil {
					m.TimeUpdated = &timestamppb.Timestamp{}
				}
			case "timeUpdated.seconds":
				if m.TimeUpdated == nil {
					m.TimeUpdated = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.TimeUpdated.Seconds = val
			case "timeUpdated.nanos":
				if m.TimeUpdated == nil {
					m.TimeUpdated = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.TimeUpdated.Nanos = int32(val)
			case "applicationID":
				val, err := strconv.ParseUint(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.ApplicationID = val
			case "branch":
				m.Branch = vals[0]
			case "cronExpr":
				m.CronExpr = vals[0]
			case "cronStartTime":
				if m.CronStartTime == nil {
					m.CronStartTime = &timestamppb.Timestamp{}
				}
			case "cronStartTime.seconds":
				if m.CronStartTime == nil {
					m.CronStartTime = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.CronStartTime.Seconds = val
			case "cronStartTime.nanos":
				if m.CronStartTime == nil {
					m.CronStartTime = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.CronStartTime.Nanos = int32(val)
			case "pipelineYmlName":
				m.PipelineYmlName = vals[0]
			case "basePipelineID":
				val, err := strconv.ParseUint(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.BasePipelineID = val
			case "enable":
				if m.Enable == nil {
					m.Enable = &wrapperspb.BoolValue{}
				}
			case "enable.value":
				if m.Enable == nil {
					m.Enable = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Enable.Value = val
			case "pipelineYml":
				m.PipelineYml = vals[0]
			case "configManageNamespaces":
				m.ConfigManageNamespaces = vals
			case "userID":
				m.UserID = vals[0]
			case "orgID":
				val, err := strconv.ParseUint(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.OrgID = val
			case "pipelineDefinitionID":
				m.PipelineDefinitionID = vals[0]
			case "pipelineSource":
				m.PipelineSource = vals[0]
			case "extra":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
			case "extra.pipelineYml":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				m.Extra.PipelineYml = vals[0]
			case "extra.clusterName":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				m.Extra.ClusterName = vals[0]
			case "extra.configManageNamespaces":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				m.Extra.ConfigManageNamespaces = vals
			case "extra.cronStartFrom":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.CronStartFrom == nil {
					m.Extra.CronStartFrom = &timestamppb.Timestamp{}
				}
			case "extra.cronStartFrom.seconds":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.CronStartFrom == nil {
					m.Extra.CronStartFrom = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.Extra.CronStartFrom.Seconds = val
			case "extra.cronStartFrom.nanos":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.CronStartFrom == nil {
					m.Extra.CronStartFrom = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.Extra.CronStartFrom.Nanos = int32(val)
			case "extra.version":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				m.Extra.Version = vals[0]
			case "extra.compensator":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
			case "extra.compensator.enable":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.Enable == nil {
					m.Extra.Compensator.Enable = &wrapperspb.BoolValue{}
				}
			case "extra.compensator.enable.value":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.Enable == nil {
					m.Extra.Compensator.Enable = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Extra.Compensator.Enable.Value = val
			case "extra.compensator.LatestFirst":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.LatestFirst == nil {
					m.Extra.Compensator.LatestFirst = &wrapperspb.BoolValue{}
				}
			case "extra.compensator.LatestFirst.value":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.LatestFirst == nil {
					m.Extra.Compensator.LatestFirst = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Extra.Compensator.LatestFirst.Value = val
			case "extra.compensator.StopIfLatterExecuted":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.StopIfLatterExecuted == nil {
					m.Extra.Compensator.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
			case "extra.compensator.StopIfLatterExecuted.value":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.Compensator == nil {
					m.Extra.Compensator = &CronCompensator{}
				}
				if m.Extra.Compensator.StopIfLatterExecuted == nil {
					m.Extra.Compensator.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Extra.Compensator.StopIfLatterExecuted.Value = val
			case "extra.lastCompensateAt":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.LastCompensateAt == nil {
					m.Extra.LastCompensateAt = &timestamppb.Timestamp{}
				}
			case "extra.lastCompensateAt.seconds":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.LastCompensateAt == nil {
					m.Extra.LastCompensateAt = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.Extra.LastCompensateAt.Seconds = val
			case "extra.lastCompensateAt.nanos":
				if m.Extra == nil {
					m.Extra = &CronExtra{}
				}
				if m.Extra.LastCompensateAt == nil {
					m.Extra.LastCompensateAt = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.Extra.LastCompensateAt.Nanos = int32(val)
			case "IsEdge":
				if m.IsEdge == nil {
					m.IsEdge = &wrapperspb.BoolValue{}
				}
			case "IsEdge.value":
				if m.IsEdge == nil {
					m.IsEdge = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.IsEdge.Value = val
			}
		}
	}
	return nil
}

// CronExtra implement urlenc.URLValuesUnmarshaler.
func (m *CronExtra) UnmarshalURLValues(prefix string, values url.Values) error {
	for key, vals := range values {
		if len(vals) > 0 {
			switch prefix + key {
			case "pipelineYml":
				m.PipelineYml = vals[0]
			case "clusterName":
				m.ClusterName = vals[0]
			case "configManageNamespaces":
				m.ConfigManageNamespaces = vals
			case "cronStartFrom":
				if m.CronStartFrom == nil {
					m.CronStartFrom = &timestamppb.Timestamp{}
				}
			case "cronStartFrom.seconds":
				if m.CronStartFrom == nil {
					m.CronStartFrom = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.CronStartFrom.Seconds = val
			case "cronStartFrom.nanos":
				if m.CronStartFrom == nil {
					m.CronStartFrom = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.CronStartFrom.Nanos = int32(val)
			case "version":
				m.Version = vals[0]
			case "compensator":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
			case "compensator.enable":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.Enable == nil {
					m.Compensator.Enable = &wrapperspb.BoolValue{}
				}
			case "compensator.enable.value":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.Enable == nil {
					m.Compensator.Enable = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Compensator.Enable.Value = val
			case "compensator.LatestFirst":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.LatestFirst == nil {
					m.Compensator.LatestFirst = &wrapperspb.BoolValue{}
				}
			case "compensator.LatestFirst.value":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.LatestFirst == nil {
					m.Compensator.LatestFirst = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Compensator.LatestFirst.Value = val
			case "compensator.StopIfLatterExecuted":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.StopIfLatterExecuted == nil {
					m.Compensator.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
			case "compensator.StopIfLatterExecuted.value":
				if m.Compensator == nil {
					m.Compensator = &CronCompensator{}
				}
				if m.Compensator.StopIfLatterExecuted == nil {
					m.Compensator.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Compensator.StopIfLatterExecuted.Value = val
			case "lastCompensateAt":
				if m.LastCompensateAt == nil {
					m.LastCompensateAt = &timestamppb.Timestamp{}
				}
			case "lastCompensateAt.seconds":
				if m.LastCompensateAt == nil {
					m.LastCompensateAt = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 64)
				if err != nil {
					return err
				}
				m.LastCompensateAt.Seconds = val
			case "lastCompensateAt.nanos":
				if m.LastCompensateAt == nil {
					m.LastCompensateAt = &timestamppb.Timestamp{}
				}
				val, err := strconv.ParseInt(vals[0], 10, 32)
				if err != nil {
					return err
				}
				m.LastCompensateAt.Nanos = int32(val)
			}
		}
	}
	return nil
}

// CronCompensator implement urlenc.URLValuesUnmarshaler.
func (m *CronCompensator) UnmarshalURLValues(prefix string, values url.Values) error {
	for key, vals := range values {
		if len(vals) > 0 {
			switch prefix + key {
			case "enable":
				if m.Enable == nil {
					m.Enable = &wrapperspb.BoolValue{}
				}
			case "enable.value":
				if m.Enable == nil {
					m.Enable = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.Enable.Value = val
			case "LatestFirst":
				if m.LatestFirst == nil {
					m.LatestFirst = &wrapperspb.BoolValue{}
				}
			case "LatestFirst.value":
				if m.LatestFirst == nil {
					m.LatestFirst = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.LatestFirst.Value = val
			case "StopIfLatterExecuted":
				if m.StopIfLatterExecuted == nil {
					m.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
			case "StopIfLatterExecuted.value":
				if m.StopIfLatterExecuted == nil {
					m.StopIfLatterExecuted = &wrapperspb.BoolValue{}
				}
				val, err := strconv.ParseBool(vals[0])
				if err != nil {
					return err
				}
				m.StopIfLatterExecuted.Value = val
			}
		}
	}
	return nil
}
