class RuboCop::Cop::Sorbet::ForbidTStruct::Property

def attr_accessor

def attr_accessor
  "#{kind} :#{name}"
end

def attr_sig

def attr_sig
  "sig { returns(#{type}) }"
end

def initialize(node, kind, name, type, default:, factory:)

def initialize(node, kind, name, type, default:, factory:)
  @node = node
  @kind = kind
  @name = name
  @type = type
  @default = default
  @factory = factory
  # A T::Struct should have both a default and a factory, if we find one let's raise an error
  raise if @default && @factory
end

def initialize_assign

def initialize_assign
  rb = String.new
  rb << "@#{name} = #{name}"
  rb << ".call" if factory
  rb
end

def initialize_param

def initialize_param
  rb = String.new
  rb << "#{name}:"
  if default
    rb << " #{default}"
  elsif factory
    rb << " #{factory}"
  elsif nilable?
    rb << " nil"
  end
  rb
end

def initialize_sig_param

def initialize_sig_param
  "#{name}: #{type}"
end

def nilable?

def nilable?
  type.start_with?("T.nilable(")
end

def type

def type
  copy = @type.gsub(/[[:space:]]+/, "").strip # Remove newlines and spaces
  copy.gsub(",", ", ") # Add a space after each comma
end