<ProjectSchemaDefinitions xmlns="http://schemas.microsoft.com/build/2009/properties">
  <ContentType Name="OpenApiReference"
               DisplayName="OpenApi file reference"
               ItemType="OpenApiReference" />

  <ContentType Name="OpenApiProjectReference"
               DisplayName="OpenApi project reference"
               ItemType="OpenApiProjectReference" />

  <ItemType Name="OpenApiReference"
            DisplayName="OpenApi File Reference" />

  <ItemType Name="OpenApiProjectReference"
            DisplayName="OpenApi Project Reference" />

  <Rule Name="OpenApiReference"
        DisplayName="File Properties"
        PageTemplate="generic"
        Description="File Properties"
        OverrideMode="Extend">
    <Rule.DataSource>
      <DataSource Persistence="ProjectFile" Label="Configuration" ItemType="OpenApiReference"
                  HasConfigurationCondition="false" SourceOfDefaultValue="AfterContext" />
    </Rule.DataSource>

    <Rule.Categories>
      <Category Name="Advanced" DisplayName="Advanced" />
      <Category Name="CodeGen" DisplayName="Code Generation" />
      <Category Name="Misc" DisplayName="Misc" />
    </Rule.Categories>

    <DynamicEnumProperty Name="{}{ItemType}" DisplayName="Build Action"  Category="Advanced"
                         Description="How the file relates to the build and deployment processes."
                         EnumProvider="ItemTypes" />

    <StringProperty Name="Identity" Visible="false" ReadOnly="true">
      <StringProperty.DataSource>
        <DataSource Persistence="Intrinsic" ItemType="OpenApiReference"
                    PersistedName="Identity" SourceOfDefaultValue="AfterContext" />
      </StringProperty.DataSource>
    </StringProperty>

    <StringProperty Name="FullPath"
                    DisplayName="Full Path"
                    ReadOnly="true"
                    Category="Misc"
                    Description="Location of the file.">
      <StringProperty.DataSource>
        <DataSource Persistence="Intrinsic" ItemType="OpenApiReference"
                    PersistedName="FullPath" SourceOfDefaultValue="AfterContext" />
      </StringProperty.DataSource>
    </StringProperty>

    <StringProperty Name="FileNameAndExtension"
                    DisplayName="File Name"
                    ReadOnly="true"
                    Category="Misc"
                    Description="Name of the file.">
      <StringProperty.DataSource>
        <DataSource Persistence="Intrinsic" ItemType="OpenApiReference"
                    PersistedName="FileNameAndExtension" SourceOfDefaultValue="AfterContext" />
      </StringProperty.DataSource>
    </StringProperty>

    <BoolProperty Name="Visible" Visible="false" Default="true" />

    <StringProperty Name="DependentUpon" Visible="false">
      <StringProperty.Metadata>
        <NameValuePair Name="DoNotCopyAcrossProjects" Value="true" />
      </StringProperty.Metadata>
    </StringProperty>

    <StringProperty Name="Link" Visible="false">
      <StringProperty.DataSource>
        <DataSource SourceOfDefaultValue="AfterContext" PersistenceStyle="Attribute" />
      </StringProperty.DataSource>
      <StringProperty.Metadata>
        <NameValuePair Name="DoNotCopyAcrossProjects" Value="true" />
      </StringProperty.Metadata>
    </StringProperty>

    <StringProperty Name="ClassName" DisplayName="Class Name"
                    Category="CodeGen"
                    Description="Name of the generated class.">
      <StringProperty.DataSource>
        <DataSource ItemType="OpenApiReference" SourceOfDefaultValue="AfterContext"
                    PersistenceStyle="Attribute" />
      </StringProperty.DataSource>
    </StringProperty>

    <StringProperty Name="CodeGenerator" Visible="false">
      <StringProperty.DataSource>
        <DataSource SourceOfDefaultValue="AfterContext" PersistenceStyle="Attribute" />
      </StringProperty.DataSource>
    </StringProperty>

    <StringProperty Name="Namespace" DisplayName="Namespace"
                    Category="CodeGen"
                    Description="Namespace to place the generated class in.">
      <StringProperty.DataSource>
        <DataSource ItemType="OpenApiReference" SourceOfDefaultValue="AfterContext"
                    PersistenceStyle="Attribute" />
      </StringProperty.DataSource>
    </StringProperty>

    <StringProperty Name="Options" DisplayName="Generator options"
                    Category="CodeGen"
                    Description="Options to pass to the code generator.">
      <StringProperty.DataSource>
        <DataSource ItemType="OpenApiReference" SourceOfDefaultValue="AfterContext"
                    PersistenceStyle="Attribute" />
      </StringProperty.DataSource>
    </StringProperty>
  </Rule>

  <Rule Name="OpenApiProjectReference"
      DisplayName="File Properties"
      PageTemplate="generic"
      Description="File Properties"
      OverrideMode="Extend">
    <Rule.DataSource>
      <DataSource Persistence="ProjectFile" Label="Configuration" ItemType="OpenApiProjectReference"
                  HasConfigurationCondition="false" SourceOfDefaultValue="AfterContext" />
    </Rule.DataSource>

    <Rule.Categories>
      <Category Name="Advanced" DisplayName="Advanced" />
      <Category Name="CodeGen" DisplayName="Code Generation" />
      <Category Name="Misc" DisplayName="Misc" />
    </Rule.Categories>

    <DynamicEnumProperty Name="{}{ItemType}" DisplayName="Build Action"  Category="Advanced"
                         Description="How the file relates to the build and deployment processes."
                         EnumProvider="ItemTypes" />

    <StringProperty Name="Identity" Visible="false" ReadOnly="true">
      <StringProperty.DataSource>
        <DataSource Persistence="Intrinsic" ItemType="OpenApiProjectReference"
                    PersistedName="Identity" SourceOfDefaultValue="AfterContext" />
      </StringProperty.DataSource>
    </StringProperty>

    <StringProperty Name="FullPath"
                    DisplayName="Full Path"
                    ReadOnly="true"
                    Category="Misc"
                    Description="Location of the project file.">
      <StringProperty.DataSource>
        <DataSource Persistence="Intrinsic" ItemType="OpenApiProjectReference"
                    PersistedName="FullPath" SourceOfDefaultValue="AfterContext" />
      </StringProperty.DataSource>
    </StringProperty>

    <StringProperty Name="FileNameAndExtension"
                    DisplayName="File Name"
                    ReadOnly="true"
                    Category="Misc"
                    Description="Name of the project file.">
      <StringProperty.DataSource>
        <DataSource Persistence="Intrinsic" ItemType="OpenApiProjectReference"
                    PersistedName="FileNameAndExtension" SourceOfDefaultValue="AfterContext" />
      </StringProperty.DataSource>
    </StringProperty>

    <BoolProperty Name="Visible" Visible="false" Default="true" />

    <StringProperty Name="CodeGenerator" Visible="false">
      <StringProperty.DataSource>
        <DataSource SourceOfDefaultValue="AfterContext" PersistenceStyle="Attribute" />
      </StringProperty.DataSource>
    </StringProperty>

    <StringProperty Name="Namespace" DisplayName="Namespace"
                    Category="CodeGen"
                    Description="Namespace to place the generated classes in.">
      <StringProperty.DataSource>
        <DataSource ItemType="OpenApiProjectReference" SourceOfDefaultValue="AfterContext"
                    PersistenceStyle="Attribute" />
      </StringProperty.DataSource>
    </StringProperty>

    <StringProperty Name="Options" DisplayName="Generator options"
                    Category="CodeGen"
                    Description="Options to pass to the code generator.">
      <StringProperty.DataSource>
        <DataSource ItemType="OpenApiProjectReference" SourceOfDefaultValue="AfterContext"
                    PersistenceStyle="Attribute" />
      </StringProperty.DataSource>
    </StringProperty>
  </Rule>
</ProjectSchemaDefinitions>
