AccessSchedule.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.ComponentModel.DataAnnotations.Schema;
  3. using System.Xml.Serialization;
  4. using Jellyfin.Data.Enums;
  5. namespace Jellyfin.Data.Entities
  6. {
  7. /// <summary>
  8. /// An entity representing a user's access schedule.
  9. /// </summary>
  10. public class AccessSchedule
  11. {
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="AccessSchedule"/> class.
  14. /// </summary>
  15. /// <param name="dayOfWeek">The day of the week.</param>
  16. /// <param name="startHour">The start hour.</param>
  17. /// <param name="endHour">The end hour.</param>
  18. /// <param name="userId">The associated user's id.</param>
  19. public AccessSchedule(DynamicDayOfWeek dayOfWeek, double startHour, double endHour, Guid userId)
  20. {
  21. UserId = userId;
  22. DayOfWeek = dayOfWeek;
  23. StartHour = startHour;
  24. EndHour = endHour;
  25. }
  26. /// <summary>
  27. /// Gets the id of this instance.
  28. /// </summary>
  29. /// <remarks>
  30. /// Identity, Indexed, Required.
  31. /// </remarks>
  32. [XmlIgnore]
  33. [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
  34. public int Id { get; private set; }
  35. /// <summary>
  36. /// Gets the id of the associated user.
  37. /// </summary>
  38. [XmlIgnore]
  39. public Guid UserId { get; private set; }
  40. /// <summary>
  41. /// Gets or sets the day of week.
  42. /// </summary>
  43. /// <value>The day of week.</value>
  44. public DynamicDayOfWeek DayOfWeek { get; set; }
  45. /// <summary>
  46. /// Gets or sets the start hour.
  47. /// </summary>
  48. /// <value>The start hour.</value>
  49. public double StartHour { get; set; }
  50. /// <summary>
  51. /// Gets or sets the end hour.
  52. /// </summary>
  53. /// <value>The end hour.</value>
  54. public double EndHour { get; set; }
  55. }
  56. }