﻿using System;
using Nancy.Metadata.Modules;
using Nancy.Swagger;
using Swagger.ObjectModel;

namespace Ligas.Api.Tournaments
{
    public class TournamentsMetadataModule : MetadataModule<PathItem>
    {
        public TournamentsMetadataModule(ISwaggerModelCatalog modelCatalog)
        {
            modelCatalog.AddModels(typeof(Tournament));

            Describe["GetTournaments"] = d => d.AsSwagger(
                with => with.Operation(
                    op => op.OperationId("GetTournaments")
                            .Tag("Tournaments")
                            .Summary("The list of tournaments")
                            .Response(r => r.Schema<Tournament>().Description("The list of tournaments"))));

            Describe["GetTournamentById"] = d => d.AsSwagger(
                with => with.Operation(
                    op => op.OperationId("GetTournamentById")
                            .Tag("Tournaments")
                            .Summary("Get touraments by Id")
                            .Parameter(new Parameter {Name = "id", Required = true, In = ParameterIn.Path })
                            .Response(r => r.Schema<Tournament>().Description("Tournament"))));
        }
    }
}