﻿using Chloe.Server.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Chloe.Server.Dtos
{
    public class UserDto
    {
        public UserDto()
        {

        }

        public UserDto(User entity)
        {
            Id = entity.Id;
            Name = entity.Name;
            Username = entity.Username;
            Email = entity.Email;
            Firstname = entity.Firstname;
            Lastname = entity.Lastname;
            Fullname = entity.Fullname;
            Roles = entity.Roles.Select(x => new RoleDto(x)).ToList();
            Brands = entity.Brands.Select(x => new BrandDto(x)).ToList();
        }

        public int Id { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }
        public string Username { get; set; }
        public string Firstname { get; set; }
        public string Lastname { get; set; }
        public string Fullname { get; set; }
        public ICollection<RoleDto> Roles = new HashSet<RoleDto>();
        public ICollection<BrandDto> Brands = new HashSet<BrandDto>();
    }
}