68 lines
1.9 KiB
C#
68 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Kreta.Naplo.Domain.V3.Enum;
|
|
|
|
namespace Kreta.Naplo.Domain.V3.Common
|
|
{
|
|
public class MobileUser
|
|
{
|
|
private const int MinimumIdentifierValue = 1;
|
|
|
|
public MobileUser(string instituteCode, int userId, string userName, IEnumerable<FelhasznaloSzerepkor> roles, int schoolYearId, Guid userIdpUniqueId, Guid instituteUniqueId)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(instituteCode))
|
|
{
|
|
throw new ArgumentException($"{nameof(instituteCode)} cannot be null or whitespace");
|
|
}
|
|
|
|
InstituteCode = instituteCode;
|
|
|
|
if (userId < MinimumIdentifierValue)
|
|
{
|
|
throw new ArgumentException($"{nameof(userId)} must be greater or equal to {MinimumIdentifierValue}");
|
|
}
|
|
|
|
UserId = userId;
|
|
|
|
if (string.IsNullOrWhiteSpace(userName))
|
|
{
|
|
throw new ArgumentException($"{nameof(userName)} cannot be null or whitespace");
|
|
}
|
|
|
|
UserName = userName;
|
|
|
|
if (roles == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(roles));
|
|
}
|
|
|
|
Roles = roles;
|
|
|
|
if (schoolYearId < MinimumIdentifierValue)
|
|
{
|
|
throw new ArgumentException($"{nameof(schoolYearId)} must be greater or equal to {MinimumIdentifierValue}");
|
|
}
|
|
|
|
SchoolYearId = schoolYearId;
|
|
|
|
UserIdpUniqueId = userIdpUniqueId;
|
|
|
|
InstituteUniqueId = instituteUniqueId;
|
|
}
|
|
|
|
public string InstituteCode { get; }
|
|
|
|
public int SchoolYearId { get; }
|
|
|
|
public IEnumerable<FelhasznaloSzerepkor> Roles { get; }
|
|
|
|
public int UserId { get; }
|
|
|
|
public string UserName { get; }
|
|
|
|
public Guid UserIdpUniqueId { get; }
|
|
|
|
public Guid InstituteUniqueId { get; }
|
|
}
|
|
}
|