lib/Classes/Public/TMUserAccount.ps1


class TMUserAccount {

    #region Non-Static Properties

    [Int64]$Id
    [String]$Username
    [Int64]$ProjectId
    [String]$Email
    [TMReference]$Company
    [String]$IsActive
    [Nullable[DateTime]]$CreatedDate
    [Nullable[DateTime]]$LastLogin
    [Nullable[DateTime]]$LastModified
    [String]$LockedOutUntil
    [Nullable[DateTime]]$LockedOutTime
    [Nullable[DateTime]]$AccountExpiration
    [String]$Password
    [String]$PasswordExpirationDate
    [Int64]$FailedLogins
    [String]$IsForcePasswordChange
    [Boolean]$IsLocalAccount = $false
    [Boolean]$IsPasswordNeverExpires
    [TMUserAccountRole[]]$RoleList
    [TMUserAccountRole[]]$AssignedRoles
    [TMUserAccountPerson]$Person

    #endregion Non-Static Properties

    #region Constructors

    TMUserAccount() {}

    TMUserAccount([Object]$object) {
        $this.Id = $object.id
        $this.Username = $object.username
        $this.ProjectId = $object.projectId
        $this.Email = $object.email
        $this.Company = [TMReference]::new($object.company)
        $this.IsActive = $object.isActive
        $this.CreatedDate = $object.createdDate
        $this.LastLogin = $object.lastLogin
        $this.LastModified = $object.lastModified
        $this.LockedOutUntil = $object.lockedOutUntil
        $this.LockedOutTime = $object.lockedOutTime
        $this.AccountExpiration = $object.accountExpiration
        $this.Password = $object.password
        $this.PasswordExpirationDate = $object.passwordExpirationDate
        $this.FailedLogins = $object.failedLogins
        $this.IsForcePasswordChange = $object.isForcePasswordChange
        $this.IsLocalAccount = $object.isLocalAccount
        $this.IsPasswordNeverExpires = $object.isPasswordNeverExpires
        $this.RoleList = $object.roleList | ForEach-Object { [TMUserAccountRole]::new($_) }
        $this.AssignedRoles = $object.assignedRoles | ForEach-Object { [TMUserAccountRole]::new($_) }
        $this.Person = [TMUserAccountPerson]::new($object.person)
    }

    #endregion Constructors

}


class TMUserAccountRole {

    #region Non-Static Properties

    [String]$Id
    [String]$Description

    #endregion Non-Static Properties

    #region Constructors

    TMUserAccountRole() {}

    TMUserAccountRole([String]$id, [String]$description) {
        $this.Id = $id
        $this.Description = $description
    }

    TMUserAccountRole([Object]$object) {
        $this.Id = $object.id
        $this.Description = $object.description
    }

    #endregion Constructors

}


class TMUserAccountPerson {

    #region Non-Static Properties

    [Int64]$Id
    [Int64]$ModelScore
    [String]$PersonImageURL
    [Int64]$TravelOK
    [Nullable[DateTime]]$DateCreated
    [String]$NickName
    [String]$FirstName
    [String]$MobilePhone
    [Nullable[DateTime]]$LastUpdated
    [String]$MiddleName
    [String]$Location
    [String]$Active
    [DateTime[]]$BlackOutDates
    [Int64]$Version
    [String]$StateProv
    [String]$StaffType
    [String]$Title
    [String]$Department
    [String]$TdsLink
    [String]$PartyType
    [String]$Name
    [String]$WorkPhone
    [String]$TdsNote
    [String]$LastName
    [String]$Country
    [String]$Guid
    [String]$Email
    [String]$KeyWords

    #endregion Non-Static Properties

    #region Constructors

    TMUserAccountPerson() {}

    TMUserAccountPerson([Object]$object) {
        $this.Id = $object.id
        $this.ModelScore = $object.modelScore
        $this.PersonImageURL = $object.personImageURL
        $this.TravelOK = $object.travelOK
        $this.DateCreated = $object.dateCreated
        $this.NickName = $object.nickName
        $this.FirstName = $object.firstName
        $this.MobilePhone = $object.mobilePhone
        $this.LastUpdated = $object.lastUpdated
        $this.MiddleName = $object.middleName
        $this.Location = $object.location
        $this.Active = $object.active
        $this.BlackOutDates = $object.blackOutDates
        $this.Version = $object.version
        $this.StateProv = $object.stateProv
        $this.StaffType = $object.staffType
        $this.Title = $object.title
        $this.Department = $object.department
        $this.TdsLink = $object.tdsLink
        $this.PartyType = $object.partyType
        $this.Name = $object.name
        $this.WorkPhone = $object.workPhone
        $this.TdsNote = $object.tdsNote
        $this.LastName = $object.lastName
        $this.Country = $object.country
        $this.Guid = $object.guid
        $this.Email = $object.email
        $this.KeyWords = $object.keyWords
    }

    #endregion Constructors

}