import { LitElement } from 'lit'

export interface DefaultComponentStates {
  'btu-error': string
  'btu-loading': string
  'btu-expanded': string
}

interface ComponentStates extends DefaultComponentStates {
  'btu-copy-to-clipboard-copied': string
}

export declare class ComponentStatesMixinInterface {
  internals: ElementInternals
  states: Set<keyof ComponentStates>
}

export const ComponentStatesMixin = <T extends Constructor<LitElement>>(
  superclass: T,
) => {
  class ComponentStatesMixinClass extends superclass {
    internals = this.attachInternals()
    states = this.internals.states
  }
  return ComponentStatesMixinClass as Constructor<ComponentStatesMixinInterface> &
    T
}
