/* tslint:disable */
/**
 * This file was automatically generated by json-schema-to-typescript.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and run json-schema-to-typescript to regenerate this file.
 */

export type PropertyInSchemIndex = number
export type SinglePropertyType =
  | ('Bool' | 'Uint16' | 'Uint32' | 'Uint64' | 'Int16' | 'Int32' | 'Int64')
  | TextProperty
  | HashProperty
  | ReferenceProperty
export type MaxTextLength = number
export type MaxVecItems = number
export type PropertyName = string
export type PropertyDescription = string
export type DefaultBoolean = boolean

/**
 * JSON schema to describe a new schema for a certain class in Joystream network
 */
export interface AddClassSchema {
  className: string
  existingProperties?: PropertyInSchemIndex[]
  newProperties: Property[]
}
export interface Property {
  property_type: SinglePropertyVariant | VecPropertyVariant
  name: PropertyName
  description?: PropertyDescription
  required?: DefaultBoolean
  unique?: DefaultBoolean
  locking_policy?: LockingPolicy
}
export interface SinglePropertyVariant {
  Single: SinglePropertyType
}
export interface TextProperty {
  Text: MaxTextLength
}
export interface HashProperty {
  Hash: MaxTextLength
}
export interface ReferenceProperty {
  Reference: {
    /**
     * Referenced class name
     */
    className: string
    /**
     * Whether same owner (controller) is required
     */
    sameOwner?: boolean
  }
}
export interface VecPropertyVariant {
  Vector: VecPropertyType
}
export interface VecPropertyType {
  vec_type: SinglePropertyType
  max_length: MaxVecItems
}
export interface LockingPolicy {
  is_locked_from_maintainer?: DefaultBoolean
  is_locked_from_controller?: DefaultBoolean
}
