/*******************************************************************************
  * Copyright (C) 2015 AgGateway and ADAPT Contributors
  * Copyright (C) 2015 Deere and Company
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html <http://www.eclipse.org/legal/epl-v10.html> 
  *
  * Contributors:
  *    Tarak Reddy, Tim Shearouse - initial API and implementation
  *******************************************************************************/

using System.Text;

namespace AgGateway.ADAPT.RepresentationTest.ClassGenerators
{
       public class DefinedTypeEnumerationInstanceListGenerator : ClassGenerator
       {
           private const string DefinedTypeEnumerationInstanceListPattern = "        public static readonly EnumerationMember {0} = RepresentationInstanceList.{1}.EnumerationMembers[(int) DefinedTypeInstanceList.{0}];";
   
           protected override string Name
           {
               get
               {
                   return "DefinedTypeEnumerationInstanceList";
               }
           }
   
           protected override bool IsEnum
           {
               get
               {
                   return false;
               }
           }
   
           protected override void Append(Representation.RepresentationSystem.EnumeratedRepresentation definedRepresentation, StringBuilder stringBuilder)
           {
               foreach (var enumerationMember in definedRepresentation.EnumerationMembers)
               {
                   stringBuilder.AppendFormat(DefinedTypeEnumerationInstanceListPattern, enumerationMember.DomainId, definedRepresentation.DomainId);
                   stringBuilder.Append("\n\n");
               }
           }
       }
}