about summary refs log tree commit diff
path: root/MatrixRoomUtils.Core/StateEventTypes/GuestAccessData.cs
blob: 1727ce916a60fbc9a2cbe2995d913782a09625d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using System.Text.Json.Serialization;
using MatrixRoomUtils.Core.Extensions;
using MatrixRoomUtils.Core.Interfaces;

namespace MatrixRoomUtils.Core.StateEventTypes;

[MatrixEvent(EventName = "m.room.guest_access")]
public class GuestAccessData : IStateEventType {
    [JsonPropertyName("guest_access")]
    public string GuestAccess { get; set; }

    public bool IsGuestAccessEnabled {
        get => GuestAccess == "can_join";
        set => GuestAccess = value ? "can_join" : "forbidden";
    }
}