aboutsummaryrefslogtreecommitdiff
path: root/Emby.Dlna/Eventing/EventSubscription.cs
blob: 4fd7f8169594864022a135b2039ccc1e0a318556 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#nullable disable

#pragma warning disable CS1591

using System;

namespace Emby.Dlna.Eventing
{
    public class EventSubscription
    {
        public string Id { get; set; }

        public string CallbackUrl { get; set; }

        public string NotificationType { get; set; }

        public DateTime SubscriptionTime { get; set; }

        public int TimeoutSeconds { get; set; }

        public long TriggerCount { get; set; }

        public bool IsExpired => SubscriptionTime.AddSeconds(TimeoutSeconds) >= DateTime.UtcNow;

        public void IncrementTriggerCount()
        {
            if (TriggerCount == long.MaxValue)
            {
                TriggerCount = 0;
            }

            TriggerCount++;
        }
    }
}