﻿// Copyright (c) 2016 BlueConcord. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
using AutoMapper;
using BlueConcord.IdentityServer.EntityFrameworkCore.Entities;
using Models = IdentityServer4.Models;

namespace BlueConcord.IdentityServer.EntityFrameworkCore.Extensions
{
    public class EntitiesMapProfile : Profile
    {
        public EntitiesMapProfile()
        {
            CreateMap<Consent, Models.Consent>(MemberList.Destination)
                .ForMember(x => x.Scopes, opts => opts.MapFrom(src => src.Scopes.ParseScopes()))
                .ForMember(x => x.Subject, opts => opts.MapFrom(src => src.SubjectId));
        }
    }
}
