declare namespace Api {
  /**
   * namespace Infra
   *
   * backend api module: "project/status/*"
   */
  namespace Infra {
    type CommonStatus = 0 | 1;

    interface PageParams {
      pageNo: number;
      pageSize: number;
    }

    interface PageResult<T = any> {
      total: number;
      list: T[];
    }

    interface ObjectStatusModel {
      id: string;
      objectType: string;
      statusCode: string;
      statusName: string;
      sort: number;
      status: CommonStatus;
      initialFlag: boolean;
      terminalFlag: boolean;
      allowEdit: boolean;
      progressExcludedFlag: boolean;
      allowCreateProject: boolean;
      allowCreateRequirement: boolean;
      remark?: string | null;
      creator?: string | null;
      createTime: string;
      updater?: string | null;
      updateTime: string;
    }

    type ObjectStatusModelSearchParams = CommonType.RecordNullable<
      Pick<PageParams, 'pageNo' | 'pageSize'> &
        Pick<ObjectStatusModel, 'objectType' | 'status' | 'initialFlag' | 'terminalFlag'> & {
          keyword?: string;
        }
    >;

    type SaveObjectStatusModelParams = Pick<
      ObjectStatusModel,
      | 'objectType'
      | 'statusCode'
      | 'statusName'
      | 'sort'
      | 'status'
      | 'initialFlag'
      | 'terminalFlag'
      | 'allowEdit'
      | 'progressExcludedFlag'
      | 'allowCreateProject'
      | 'allowCreateRequirement'
    > & {
      remark?: string | null;
    };

    type ObjectStatusModelList = PageResult<ObjectStatusModel>;

    interface ObjectStatusTransition {
      id: string;
      objectType: string;
      actionCode: string;
      actionName: string;
      fromStatusCode: string;
      fromStatusName?: string | null;
      toStatusCode: string;
      toStatusName?: string | null;
      needReason: boolean;
      status: CommonStatus;
      remark?: string | null;
      creator?: string | null;
      createTime: string;
      updater?: string | null;
      updateTime: string;
    }

    type ObjectStatusTransitionSearchParams = CommonType.RecordNullable<
      Pick<PageParams, 'pageNo' | 'pageSize'> &
        Pick<
          ObjectStatusTransition,
          'objectType' | 'fromStatusCode' | 'toStatusCode' | 'status' | 'actionCode' | 'actionName'
        >
    >;

    type SaveObjectStatusTransitionParams = Pick<
      ObjectStatusTransition,
      'objectType' | 'actionCode' | 'actionName' | 'fromStatusCode' | 'toStatusCode' | 'needReason' | 'status'
    > & {
      remark?: string | null;
    };

    type ObjectStatusTransitionList = PageResult<ObjectStatusTransition>;
  }
}
