// Code generated by Microsoft Kiota - DO NOT EDIT.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

package models

import (
    i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)

type SharePointMigrationJobErrorEvent struct {
    SharePointMigrationEvent
}
// NewSharePointMigrationJobErrorEvent instantiates a new SharePointMigrationJobErrorEvent and sets the default values.
func NewSharePointMigrationJobErrorEvent()(*SharePointMigrationJobErrorEvent) {
    m := &SharePointMigrationJobErrorEvent{
        SharePointMigrationEvent: *NewSharePointMigrationEvent(),
    }
    return m
}
// CreateSharePointMigrationJobErrorEventFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
// returns a Parsable when successful
func CreateSharePointMigrationJobErrorEventFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
    return NewSharePointMigrationJobErrorEvent(), nil
}
// GetError gets the error property value. The error property
// returns a PublicErrorable when successful
func (m *SharePointMigrationJobErrorEvent) GetError()(PublicErrorable) {
    val, err := m.GetBackingStore().Get("error")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(PublicErrorable)
    }
    return nil
}
// GetErrorLevel gets the errorLevel property value. The errorLevel property
// returns a *SharePointMigrationJobErrorLevel when successful
func (m *SharePointMigrationJobErrorEvent) GetErrorLevel()(*SharePointMigrationJobErrorLevel) {
    val, err := m.GetBackingStore().Get("errorLevel")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*SharePointMigrationJobErrorLevel)
    }
    return nil
}
// GetFieldDeserializers the deserialization information for the current model
// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful
func (m *SharePointMigrationJobErrorEvent) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
    res := m.SharePointMigrationEvent.GetFieldDeserializers()
    res["error"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetObjectValue(CreatePublicErrorFromDiscriminatorValue)
        if err != nil {
            return err
        }
        if val != nil {
            m.SetError(val.(PublicErrorable))
        }
        return nil
    }
    res["errorLevel"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetEnumValue(ParseSharePointMigrationJobErrorLevel)
        if err != nil {
            return err
        }
        if val != nil {
            m.SetErrorLevel(val.(*SharePointMigrationJobErrorLevel))
        }
        return nil
    }
    res["objectId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetStringValue()
        if err != nil {
            return err
        }
        if val != nil {
            m.SetObjectId(val)
        }
        return nil
    }
    res["objectType"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetEnumValue(ParseSharePointMigrationObjectType)
        if err != nil {
            return err
        }
        if val != nil {
            m.SetObjectType(val.(*SharePointMigrationObjectType))
        }
        return nil
    }
    res["objectUrl"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetStringValue()
        if err != nil {
            return err
        }
        if val != nil {
            m.SetObjectUrl(val)
        }
        return nil
    }
    res["totalRetryCount"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetInt32Value()
        if err != nil {
            return err
        }
        if val != nil {
            m.SetTotalRetryCount(val)
        }
        return nil
    }
    return res
}
// GetObjectId gets the objectId property value. The object ID. Read-only.
// returns a *string when successful
func (m *SharePointMigrationJobErrorEvent) GetObjectId()(*string) {
    val, err := m.GetBackingStore().Get("objectId")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*string)
    }
    return nil
}
// GetObjectType gets the objectType property value. The objectType property
// returns a *SharePointMigrationObjectType when successful
func (m *SharePointMigrationJobErrorEvent) GetObjectType()(*SharePointMigrationObjectType) {
    val, err := m.GetBackingStore().Get("objectType")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*SharePointMigrationObjectType)
    }
    return nil
}
// GetObjectUrl gets the objectUrl property value. The object URL. Read-only.
// returns a *string when successful
func (m *SharePointMigrationJobErrorEvent) GetObjectUrl()(*string) {
    val, err := m.GetBackingStore().Get("objectUrl")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*string)
    }
    return nil
}
// GetTotalRetryCount gets the totalRetryCount property value. The current retry count of the job. Read-only.
// returns a *int32 when successful
func (m *SharePointMigrationJobErrorEvent) GetTotalRetryCount()(*int32) {
    val, err := m.GetBackingStore().Get("totalRetryCount")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*int32)
    }
    return nil
}
// Serialize serializes information the current object
func (m *SharePointMigrationJobErrorEvent) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
    err := m.SharePointMigrationEvent.Serialize(writer)
    if err != nil {
        return err
    }
    {
        err = writer.WriteObjectValue("error", m.GetError())
        if err != nil {
            return err
        }
    }
    if m.GetErrorLevel() != nil {
        cast := (*m.GetErrorLevel()).String()
        err = writer.WriteStringValue("errorLevel", &cast)
        if err != nil {
            return err
        }
    }
    {
        err = writer.WriteStringValue("objectId", m.GetObjectId())
        if err != nil {
            return err
        }
    }
    if m.GetObjectType() != nil {
        cast := (*m.GetObjectType()).String()
        err = writer.WriteStringValue("objectType", &cast)
        if err != nil {
            return err
        }
    }
    {
        err = writer.WriteStringValue("objectUrl", m.GetObjectUrl())
        if err != nil {
            return err
        }
    }
    {
        err = writer.WriteInt32Value("totalRetryCount", m.GetTotalRetryCount())
        if err != nil {
            return err
        }
    }
    return nil
}
// SetError sets the error property value. The error property
func (m *SharePointMigrationJobErrorEvent) SetError(value PublicErrorable)() {
    err := m.GetBackingStore().Set("error", value)
    if err != nil {
        panic(err)
    }
}
// SetErrorLevel sets the errorLevel property value. The errorLevel property
func (m *SharePointMigrationJobErrorEvent) SetErrorLevel(value *SharePointMigrationJobErrorLevel)() {
    err := m.GetBackingStore().Set("errorLevel", value)
    if err != nil {
        panic(err)
    }
}
// SetObjectId sets the objectId property value. The object ID. Read-only.
func (m *SharePointMigrationJobErrorEvent) SetObjectId(value *string)() {
    err := m.GetBackingStore().Set("objectId", value)
    if err != nil {
        panic(err)
    }
}
// SetObjectType sets the objectType property value. The objectType property
func (m *SharePointMigrationJobErrorEvent) SetObjectType(value *SharePointMigrationObjectType)() {
    err := m.GetBackingStore().Set("objectType", value)
    if err != nil {
        panic(err)
    }
}
// SetObjectUrl sets the objectUrl property value. The object URL. Read-only.
func (m *SharePointMigrationJobErrorEvent) SetObjectUrl(value *string)() {
    err := m.GetBackingStore().Set("objectUrl", value)
    if err != nil {
        panic(err)
    }
}
// SetTotalRetryCount sets the totalRetryCount property value. The current retry count of the job. Read-only.
func (m *SharePointMigrationJobErrorEvent) SetTotalRetryCount(value *int32)() {
    err := m.GetBackingStore().Set("totalRetryCount", value)
    if err != nil {
        panic(err)
    }
}
type SharePointMigrationJobErrorEventable interface {
    i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
    SharePointMigrationEventable
    GetError()(PublicErrorable)
    GetErrorLevel()(*SharePointMigrationJobErrorLevel)
    GetObjectId()(*string)
    GetObjectType()(*SharePointMigrationObjectType)
    GetObjectUrl()(*string)
    GetTotalRetryCount()(*int32)
    SetError(value PublicErrorable)()
    SetErrorLevel(value *SharePointMigrationJobErrorLevel)()
    SetObjectId(value *string)()
    SetObjectType(value *SharePointMigrationObjectType)()
    SetObjectUrl(value *string)()
    SetTotalRetryCount(value *int32)()
}
