<|start_filename|>Unity/SilphidTest/Assets/Examples/Showzup/ViewModels/PhotoViewModel.cs<|end_filename|>
using System;
using Silphid.Showzup;

public class PhotoViewModel : ViewModel<Photo>
{
    public Uri ImageUri =>
        new Uri($"res://Photos/{Model.Photographer.Id}-{Model.Id}.jpg");

    private PhotographerViewModel _photographer;
    public PhotographerViewModel Photographer =>
        _photographer = _photographer ?? new PhotographerViewModel(Model.Photographer);
    
    public PhotoViewModel(Photo photo) : base(photo)
    {
    }
}

<|start_filename|>Unity/SilphidTest/Assets/Examples/Showzup/ViewModels/PhotographerViewModel.cs<|end_filename|>
using System;
using Silphid.Showzup;

public class PhotographerViewModel : ViewModel<Photographer>
{
    public string Name => Model.Name;
    public string Location => Model.Location;
    public string Website => Model.Website;
    public Uri ImageUri => new Uri($"res://Photographers/{Model.Id}.jpg");

    public PhotographerViewModel(Photographer photographer) : base(photographer)
    {
    }
}

<|start_filename|>Unity/SilphidTest/Assets/Examples/Showzup/Models/Photo.cs<|end_filename|>
﻿public class Photo
{
    public string Id { get; }
    public Photographer Photographer { get; }

    public Photo(string id, Photographer photographer)
    {
        Id = id;
        Photographer = photographer;
    }
}


<|start_filename|>Unity/SilphidTest/Assets/Examples/Showzup/Models/Photographer.cs<|end_filename|>
public class Photographer
{
    public string Id { get; }
    public string Name { get; }
    public string Location { get; }
    public string Website { get; }

    public Photographer(string id, string name, string location, string website)
    {
        Id = id;
        Name = name;
        Location = location;
        Website = website;
    }
}

<|start_filename|>Unity/SilphidTest/Assets/Examples/Showzup/ViewModels/CatalogViewModel.cs<|end_filename|>
using System.Collections.Generic;
using Silphid.Showzup;

public class CatalogViewModel : ViewModel<Catalog>
{
    public List<Photo> Photos => Model.Photos;

    public CatalogViewModel(Catalog catalog) : base(catalog)
    {
    }
}

<|start_filename|>Unity/SilphidTest/Assets/Plugins/Integrations/Showzup+Injexit/InjectionAdapter.cs<|end_filename|>
using System;
using System.Collections.Generic;
using Silphid.Injexit;

namespace Silphid.Showzup
{
    /// <summary>
    /// Used by Showzup for all dependency injection (DI) needs. The IInjectionAdapter interface abstracts the DI
    /// framework away from Showzup, so that another DI framework could (in theory) be swapped in, if it
    /// supports all required functionalities.
    /// </summary>
    public class InjectionAdapter : IInjectionAdapter
    {
        private readonly IContainer _container;

        public InjectionAdapter(IContainer container)
        {
            _container = container;
        }

        public object Resolve(Type type, IDictionary<Type, object> parameters = null) =>
            parameters == null
                ? _container.Resolve(type)
                : _container
                    .Using(x => x.BindInstances(parameters))
                    .Resolve(type);

        public void Inject(object obj, IDictionary<Type, object> parameters = null)
        {
            if (parameters == null)
                _container.Inject(obj);
            else
                _container
                    .Using(x => x.BindInstances(parameters))
                    .Inject(obj);
        }
    }
}

<|start_filename|>Unity/SilphidTest/Assets/Examples/Showzup/Models/Catalog.cs<|end_filename|>
using System.Collections.Generic;

public class Catalog
{
    public List<Photo> Photos { get; } = new List<Photo>();

    public Catalog()
    {
        Photos.AddRange(new []
        {
            new Photo("235177", new Photographer("erico-marcelino", "<NAME>", "Sydney, Australia", "")), 
            new Photo("2554",   new Photographer("jeff-sheldon", "<NAME>", "Downingtown, PA", "ugmonk.com/gather")), 
            new Photo("260835", new Photographer("jonatan-pie", "<NAME>", "Iceland", "")),
            new Photo("134977", new Photographer("lobostudio-hamburg", "LoboStudio Hamburg", "Hamburg", "lobostudio.de")), 
            new Photo("229776", new Photographer("maarten-deckers", "<NAME>", "Leuven, Belgium", "maartendeckers.com")), 
            new Photo("274716", new Photographer("martin-jernberg", "<NAME>", "Boston, MA", "martinjphoto.com")),
            new Photo("194690", new Photographer("patrick-baum", "<NAME>", "Frankfurt, Germany", "instagram.com/gecko81de")),
            new Photo("214954", new Photographer("paul-morris", "<NAME>", "Manchester, UK", "flickr.com/photos/62438406@n00")), 
            new Photo("234486", new Photographer("vivek-kumar", "<NAME>", "India", "vivekkumar.me"))
        });
    }
}