use super::{Corporation, CorporationStructure};
use crate::{get_authenticated, get_public, Esi, EsiResult, Response};

impl Esi {
  pub async fn get_corporation(
    &self,
    corporation_id: i32,
    etag: Option<&str>,
  ) -> EsiResult<Response<Corporation>> {
    let result = get_public::<Corporation>(
      &format!("corporations/{}", corporation_id),
      self,
      None,
      etag,
    )
    .await?;
    Ok(result)
  }

  pub async fn get_corporation_structures(
    &self,
    corporation_id: i32,
    access_token: &str,
    etag: Option<&str>,
  ) -> EsiResult<Response<Vec<CorporationStructure>>> {
    let result = get_authenticated::<Vec<CorporationStructure>>(
      access_token,
      &format!("corporations/{}/structures", corporation_id),
      self,
      None,
      etag,
    )
    .await?;
    Ok(result)
  }
}
