jellyfin/Jellyfin.Data/Entities/AccessSchedule.cs

63 lines
1.9 KiB
C#
Raw Normal View History

2020-05-15 14:24:01 -07:00
using System;
2020-05-12 19:10:35 -07:00
using System.ComponentModel.DataAnnotations.Schema;
2020-05-26 18:20:55 -07:00
using System.Xml.Serialization;
2020-05-12 19:10:35 -07:00
using Jellyfin.Data.Enums;
namespace Jellyfin.Data.Entities
{
2020-05-22 17:20:18 -07:00
/// <summary>
/// An entity representing a user's access schedule.
/// </summary>
2020-05-12 19:10:35 -07:00
public class AccessSchedule
{
/// <summary>
/// Initializes a new instance of the <see cref="AccessSchedule"/> class.
/// </summary>
/// <param name="dayOfWeek">The day of the week.</param>
/// <param name="startHour">The start hour.</param>
/// <param name="endHour">The end hour.</param>
2020-05-22 17:20:18 -07:00
/// <param name="userId">The associated user's id.</param>
2020-05-15 14:24:01 -07:00
public AccessSchedule(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId)
2020-05-12 19:10:35 -07:00
{
2020-05-15 14:24:01 -07:00
UserId = userId;
2020-05-12 19:10:35 -07:00
DayOfWeek = dayOfWeek;
StartHour = startHour;
EndHour = endHour;
}
2020-05-22 17:20:18 -07:00
/// <summary>
2021-03-17 16:08:11 -07:00
/// Gets the id of this instance.
2020-05-22 17:20:18 -07:00
/// </summary>
/// <remarks>
/// Identity, Indexed, Required.
/// </remarks>
2020-05-26 18:20:55 -07:00
[XmlIgnore]
2020-05-12 19:10:35 -07:00
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
2021-03-17 16:08:11 -07:00
public int Id { get; private set; }
2020-05-15 14:24:01 -07:00
2020-05-22 17:20:18 -07:00
/// <summary>
2021-03-17 16:08:11 -07:00
/// Gets the id of the associated user.
2020-05-22 17:20:18 -07:00
/// </summary>
2020-05-26 18:20:55 -07:00
[XmlIgnore]
2021-03-17 16:08:11 -07:00
public Guid UserId { get; private set; }
2020-05-12 19:10:35 -07:00
/// <summary>
/// Gets or sets the day of week.
/// </summary>
/// <value>The day of week.</value>
public DynamicDayOfWeek DayOfWeek { get; set; }
/// <summary>
/// Gets or sets the start hour.
/// </summary>
/// <value>The start hour.</value>
public double StartHour { get; set; }
/// <summary>
/// Gets or sets the end hour.
/// </summary>
/// <value>The end hour.</value>
public double EndHour { get; set; }
}
}