// 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 LevelMap struct {
    BaseMapFeature
}
// NewLevelMap instantiates a new LevelMap and sets the default values.
func NewLevelMap()(*LevelMap) {
    m := &LevelMap{
        BaseMapFeature: *NewBaseMapFeature(),
    }
    odataTypeValue := "#microsoft.graph.levelMap"
    m.SetOdataType(&odataTypeValue)
    return m
}
// CreateLevelMapFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
// returns a Parsable when successful
func CreateLevelMapFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
    return NewLevelMap(), nil
}
// GetFieldDeserializers the deserialization information for the current model
// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful
func (m *LevelMap) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
    res := m.BaseMapFeature.GetFieldDeserializers()
    res["fixtures"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetCollectionOfObjectValues(CreateFixtureMapFromDiscriminatorValue)
        if err != nil {
            return err
        }
        if val != nil {
            res := make([]FixtureMapable, len(val))
            for i, v := range val {
                if v != nil {
                    res[i] = v.(FixtureMapable)
                }
            }
            m.SetFixtures(res)
        }
        return nil
    }
    res["placeId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetStringValue()
        if err != nil {
            return err
        }
        if val != nil {
            m.SetPlaceId(val)
        }
        return nil
    }
    res["sections"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetCollectionOfObjectValues(CreateSectionMapFromDiscriminatorValue)
        if err != nil {
            return err
        }
        if val != nil {
            res := make([]SectionMapable, len(val))
            for i, v := range val {
                if v != nil {
                    res[i] = v.(SectionMapable)
                }
            }
            m.SetSections(res)
        }
        return nil
    }
    res["units"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
        val, err := n.GetCollectionOfObjectValues(CreateUnitMapFromDiscriminatorValue)
        if err != nil {
            return err
        }
        if val != nil {
            res := make([]UnitMapable, len(val))
            for i, v := range val {
                if v != nil {
                    res[i] = v.(UnitMapable)
                }
            }
            m.SetUnits(res)
        }
        return nil
    }
    return res
}
// GetFixtures gets the fixtures property value. Collection of fixtures (such as furniture or equipment) on this level. Supports upsert.
// returns a []FixtureMapable when successful
func (m *LevelMap) GetFixtures()([]FixtureMapable) {
    val, err := m.GetBackingStore().Get("fixtures")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.([]FixtureMapable)
    }
    return nil
}
// GetPlaceId gets the placeId property value. Identifier of the floor to which this levelMap belongs.
// returns a *string when successful
func (m *LevelMap) GetPlaceId()(*string) {
    val, err := m.GetBackingStore().Get("placeId")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.(*string)
    }
    return nil
}
// GetSections gets the sections property value. Collection of sections (such as zones or partitions) on this level. Supports upsert.
// returns a []SectionMapable when successful
func (m *LevelMap) GetSections()([]SectionMapable) {
    val, err := m.GetBackingStore().Get("sections")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.([]SectionMapable)
    }
    return nil
}
// GetUnits gets the units property value. Collection of units (such as rooms or offices) on this level. Supports upsert.
// returns a []UnitMapable when successful
func (m *LevelMap) GetUnits()([]UnitMapable) {
    val, err := m.GetBackingStore().Get("units")
    if err != nil {
        panic(err)
    }
    if val != nil {
        return val.([]UnitMapable)
    }
    return nil
}
// Serialize serializes information the current object
func (m *LevelMap) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
    err := m.BaseMapFeature.Serialize(writer)
    if err != nil {
        return err
    }
    if m.GetFixtures() != nil {
        cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetFixtures()))
        for i, v := range m.GetFixtures() {
            if v != nil {
                cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
            }
        }
        err = writer.WriteCollectionOfObjectValues("fixtures", cast)
        if err != nil {
            return err
        }
    }
    {
        err = writer.WriteStringValue("placeId", m.GetPlaceId())
        if err != nil {
            return err
        }
    }
    if m.GetSections() != nil {
        cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetSections()))
        for i, v := range m.GetSections() {
            if v != nil {
                cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
            }
        }
        err = writer.WriteCollectionOfObjectValues("sections", cast)
        if err != nil {
            return err
        }
    }
    if m.GetUnits() != nil {
        cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetUnits()))
        for i, v := range m.GetUnits() {
            if v != nil {
                cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
            }
        }
        err = writer.WriteCollectionOfObjectValues("units", cast)
        if err != nil {
            return err
        }
    }
    return nil
}
// SetFixtures sets the fixtures property value. Collection of fixtures (such as furniture or equipment) on this level. Supports upsert.
func (m *LevelMap) SetFixtures(value []FixtureMapable)() {
    err := m.GetBackingStore().Set("fixtures", value)
    if err != nil {
        panic(err)
    }
}
// SetPlaceId sets the placeId property value. Identifier of the floor to which this levelMap belongs.
func (m *LevelMap) SetPlaceId(value *string)() {
    err := m.GetBackingStore().Set("placeId", value)
    if err != nil {
        panic(err)
    }
}
// SetSections sets the sections property value. Collection of sections (such as zones or partitions) on this level. Supports upsert.
func (m *LevelMap) SetSections(value []SectionMapable)() {
    err := m.GetBackingStore().Set("sections", value)
    if err != nil {
        panic(err)
    }
}
// SetUnits sets the units property value. Collection of units (such as rooms or offices) on this level. Supports upsert.
func (m *LevelMap) SetUnits(value []UnitMapable)() {
    err := m.GetBackingStore().Set("units", value)
    if err != nil {
        panic(err)
    }
}
type LevelMapable interface {
    BaseMapFeatureable
    i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
    GetFixtures()([]FixtureMapable)
    GetPlaceId()(*string)
    GetSections()([]SectionMapable)
    GetUnits()([]UnitMapable)
    SetFixtures(value []FixtureMapable)()
    SetPlaceId(value *string)()
    SetSections(value []SectionMapable)()
    SetUnits(value []UnitMapable)()
}
