class Api::V1::Projects::Sca::CreateProjectService <  Api::V1::Projects::Sca::BaseService
  def initialize(project)
    @project = project
    @owner = project&.owner.login
    @repo = project&.identifier
  end

  def call
    params = {
      "org_id": sca_user_info["default_org"],
      "team_id_list": [sca_team_id],
      "name": @repo,
      "provider": "gitea_hs",
      "external_id": "#{@owner}&|&#{@repo}",
      "description": @project.description
    }
    data = sca_post_request("projects/", params)
    if @project.update(sca_project_id:data[:json]["id"])
      true
    else
      false
    end
  end

end